Format date time
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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