LSParseDateTime

Description

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.

International functions

Syntax

LSParseDateTime(date/time-string) 

See also

ParseDateTime, SetLocale

Parameters

Parameter
Description
date/time-string
String to convert to date/time object. The string must be in a form that is readable in the current locale setting. By default, the locale is set to English (US).

Usage

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 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"  

If you specify a year in the date, specify the full year.

If the date is formatted for a locale other than the English (US) locale, add or subtract the conversion time.

Year values 0 - 29 are interpreted as 21st century dates. Year values 30 - 99 are interpreted as 20th century dates.


Note

LSParseDateTime does not accept POP dates, nor does it convert dates to Greenwich Mean Time.


Example

<!--- 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 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>