A locale-specific version of the ParseDateTime function, except that there is no option for POP date/time object parsing. Returns a date/time object.
See also ParseDateTime and SetLocale.
LSParseDateTime(date-time-string)
String being converted to date/time object. This string must be in a form that is readable in the current locale setting. By default the locale is set to English (US).
When passing a date/time value for the English (US) locale, the date-time string can be in any of the following forms:
Date-Time Formats for the English (US) Locale | |
---|---|
Date-Time Composition | Example |
dd mmmm yyyy | "25 January 1999" |
hh:mm:ss | "8:30:00" |
hh:mm:ss | "20:30:00" |
mmmm dd, yyyy hh:mm:ss | "January 25, 1999 8:30:00" |
hh:mm:ss mmm. dd, yyyy | "8:30:00 Jan. 25, 1999" |
m/dd/yyyy hh:mm:ss | "1/25/1999 8:30:00" |
Note that if you specify a year in the date, you should specify the full year.
If the date is formatted for a locale other than the English (US) locale, add or subtract the conversion time, depending on the locale. LSParseDateTime does not accept POP dates, nor does it have the capacity to convert dates to Greenwich Mean Time.
Years from 0 to 29 are interpreted as 21st century values. Years 30 to 99 are interpreted as 20th century values.
<!--- This shows LSParseDateTime ---> <HTML> <HEAD> <TITLE>LSParseDateTime Example</TITLE> </HEAD> <BODY> <H3>LSParseDateTime Example</H3> <P>LSParseDateTime returns a locale-specific date/time object. <!--- loop through a list of possible locales and show date values for Now()---> <CFLOOP LIST="#Server.Coldfusion.SupportedLocales#" INDEX="locale" DELIMITERS=","> <CFSET oldlocale = SetLocale(locale)> <CFOUTPUT><P><B><I>#locale#</I></B><BR> <P>Locale-specific formats: <BR>#LSDateFormat(Now(), "mmm-dd-yyyy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now(), "mmmm d, yyyy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now(), "mm/dd/yyyy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now(), "d-mmm-yyyy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now(), "ddd, mmmm dd, yyyy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now(), "d/m/yy")# #LSTimeFormat(Now())#<BR> #LSDateFormat(Now())# #LSTimeFormat(Now())#<BR> <P>Standard Date/Time: #LSParseDateTime("#LSDateFormat(Now())# #LSTimeFormat(Now())#")#<BR> <Hr noshade> </CFOUTPUT> </CFLOOP> </BODY> </HTML>