The DATETOSTRING function accepts a numeric representation of a date, a time, or both and converts the number to a string representation.
The DATETOSTRING function has the following format:
DATETOSTRING(date_time[, format_string])
The DATETOSTRING function accepts the following parameters:
date_time (number)
Specifies a date, a time, or both as the number of seconds that have passed since January 1, 1970. If the date_time is invalid, the function returns the value "INVALID DATE".
format_string (string)
(Optional) Specifies the format of a date, a time, or both in the resulting string using the format codes listed in the table. Any characters or character combinations not listed in the table are inserted in the resulting string as is. If the format_string is omitted, the function formats the resulting string using the date and time representation appropriate for the locale that is currently stored in the Policy Server. The format codes and resulting formats are:
Code |
Resulting Format |
---|---|
%a |
Abbreviated weekday name (English) |
%A |
Full weekday name (English) |
%b |
Abbreviated month name (English) |
%B |
Full month name (English) |
%c |
Date and time representation appropriate for current locale |
%#c |
Long date and time representation appropriate for current locale |
%d |
Day of month as decimal number (01-31) |
%H |
Hour in 24-hour format (00-23) |
%I |
Hour in 12-hour format (01-12) |
%j |
Day of year as decimal number (001-366) |
%m |
Month as decimal number (01-12) |
%M |
Minute as decimal number (00-59) |
%P |
Local am and pm indicator for 12-hour clock |
%S |
Second as decimal number (00-59) |
%U |
Week of year as decimal number with Sunday as first day of week (00-53) |
%w |
Weekday as decimal number (0-6 with Sunday as 0) |
%W |
Week of year as decimal number with Monday as first day of week (00-53) |
%x |
Date representation appropriate for current locale |
%#x |
Long date representation appropriate for current locale |
%X |
Time representation appropriate for current locale |
%y |
Year without century as decimal number (00-99) |
%Y |
Year with century as decimal number |
%z, %Z |
Time-zone name or abbreviation if known |
%% |
Percent sign |
Note: The pound sign modifies the meaning of the format codes, as follows.
The DATETOSTRING function returns a string.
Return_value=DATETOSTRING(1024804800, '%Y%m%d')
Return_value='20020223'
Return_value=DATETOSTRING(1024804800, '%Y%#m%#d')
Return_value='2002223'
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |