ParseDateTime

Description

Formats a date/time string according to the English (U.S.) locale convention. (To format a date/time string for other locales, use the LSParseDateTime function.)

Return value

An English (U.S.)-formatted date/time value.

Category

Date and time functions, Display and formatting functions

Syntax

ParseDateTime(date/time-string [, pop-conversion ] )  

See also

IsDate, IsNumericDate, SetLocale

Parameters

Parameter Description
date/time string
A date/time string or a variable that contains one.
A date/time object is in the range 100 AD-9999 AD. See "How ColdFusion processes two-digit year values".
pop-conversion
  • pop: formats a date/time string to UTC, for the English (US) locale
  • standard: function does no conversion. See the Usage section.

Usage

This function is similar to CreateDateTime, but it takes a string instead of enumerated date/time values. These functions are provided primarily to increase the readability of code in compound expressions.

When passing a date/time value as a string, you must enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object.

To calculate a difference between time zones, use the GetTimeZoneInfo function.

To set the default display format of date, time, number, and currency values, use the SetLocale function.

Note:   This function does not accept POP dates.

Example

<h3>ParseDateTime Example</h3>
<cfif IsDefined("FORM.theTestValue")>
  <cfif IsDate(FORM.theTestValue)>
  <h3>The expression <cfoutput>#DE(FORM.theTestValue)#</cfoutput> is a valid date</h3>
  <p>The date, parsed for use as a date/time value:
   <cfoutput>#ParseDateTime(FORM.theTestValue)#
</cfoutput>

Comments