Format date time: Difference between revisions
Jump to navigation
Jump to search
imported>Bale r10078 & r10081 |
imported>Fluxxdog Update broken link |
||
Line 19: | Line 19: | ||
}}| | }}| | ||
function_description=Full information on [http:// | function_description=Full information on [http://docs.oracle.com/javase/1.5.0/docs/api/java/text/SimpleDateFormat.html SimpleDateFormat] here.| | ||
code1={{CodeSample| | code1={{CodeSample| |
Latest revision as of 14:13, 20 October 2014
Function Syntax
string format_date_time(string inFormat ,string dtg ,string outFormat )
- inFormat is how the input string is formatted.
- dtg is the time to reformat.
- outFormat is how the output string should be formatted.
Full information on SimpleDateFormat here.
Code Sample
Examples of using format_date_time().
string input;
string format;
string informat;
input = today_to_string();
informat = "yyyyMMdd";
format = "yyyy MM dd";
print(input+" * "+format_date_time(informat, input, format));
format = "yyyy MM dd hh:mm:ss";
print(input+" * "+format_date_time(informat, input, format));
input = time_to_string();
print(input+" * "+format_date_time(informat, input, format));
informat = "hh:mm:ss z";
print(input+" * "+format_date_time(informat, input, format));
This is the output:
20111206 * 2011 12 06 20111206 * 2011 12 06 12:00:00 11:43:35 EST * Bad parameter(s) passed to format_date_time 11:43:35 EST * 1970 01 01 11:43:35