Whatever message this page gives is out now! Go check it out!

LSParseDateTime

Last update:
May 18, 2026

Description

Converts a string that is a valid date/time representation in the current locale into a date/time object.

Returns

A date/time object.

Category

Function syntax

LSParseDateTime(date [, locale, format])

See also

LSDateFormatParseDateTimeSetLocaleGetLocaleLocales in the Developing ColdFusion Applications

History

ColdFusion (2018 release): Introduced named parameters.
ColdFusion (2016 release) Update 3:
  • You can use the masks t and tt to create a date/time object. For single-character time marker string, use t. For multiple-character time marker string, use tt .
  • mm is deprecated. Use nn for minutes.
ColdFusion 10: Added the format parameter.
ColdFusion 8: Added the locale parameter.ColdFusion MX:
  • Changed formatting behavior: this function might not parse string formats that worked with earlier releases. This function uses Java standard locale formatting rules on all platforms.
  • Changed how the date/time-string parameter value is processed: ColdFusion processes the date/time-string parameter value time zone information differently than in earlier releases, as described in the Usage section.

Parameters

Parameter
Description
date
A string a variable that contains one, in a format that is readable in the current locale.
format
Optional, provides the format of the string. This string is used to parse the given date string to date time object.
locale
Locale to use instead of the locale of the page when processing the function

Usage

This function can parse any date, time, or date/time combination that conforms to Java standard locale formatting rules for the current locale.The following table lists some of the date/time values you can pass to this function in the English (US) locale. You can also pass only the date or the time parts of these formats:
Format
Example
m/dd/yy h:nn:ss
1/30/02 7:02:33
m/dd/yy h:nn tt
1/30/02 7:02 AM
m/dd/yyyy h:nn
1/30/2002 7:02 AM
mmm dd, yyyy h:nn:ss tt
Jan 30, 2002 7:02:12 AM
mmmm dd, yyyy h:nn:ss tt zzz
January 30, 2002 7:02:23 AM PST
ddd, mmm dd, yyyy hh:nn:ss
Wed, Jan 30, 2002 07:02:12
dddd, mmmm dd, yyyy h:nn:ss tt zzz
Wednesday, January 30, 2002 7:02:12 AM PST
Valid dates are in the range 100 AD-9999 AD. Two-digit years in the range 00-29 are interpreted as being 2000-2029. Two-digit years in the range 30-99 are interpreted as being 1930-1999. This function corrects for differences between the current time zone and any time zone specified in the input parameter.
  • If a time zone specified in the date/time-string parameter is different from the time zone setting of the computer, ColdFusion adjusts the time value to its equivalent in the computer time zone.
  • If a time zone is not specified in the date/time-string parameter, ColdFusion does not adjust the time value.
Note:
This function does not accept POP dates, which include a time zone offset value.
In the following example, the parameter formatspecifies the way in which the given date string should be read:
<cfoutput>#lsParseDateTime("01/08/2011","en","MM/dd/yyyy")#</cfoutput>
Output
{ts '2018-10-16 00:00:00'}

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page