ParseDateTime

Description

Returns a date/time object from a string. ParseDateTime converts date/time strings that are in the U.S. date format. Use LSParseDateTime for international date parsing.

Category

Date and time functions

Syntax


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

See also

IsDate, IsNumericDate

Parameters

Parameter
Description
date/time-string
String to convert to date/time object
pop-conversion
POP or STANDARD. If you specify POP, the function takes the date/time string passed from a POP mail server and converts it to GMT (Greenwich Mean Time) for the English (US) locale. If you specify STANDARD or nothing, the function provides no conversion. See the Note for more information about parsing date/time strings that are not from the English (US) locale.

Usage

ParseDateTime is similar to CreateDateTime except that it takes a string instead of specifically enumerated date/time values.

ParseDateTime and CreateDateTime are provided primarily to increase the readability of code in compound expressions.

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

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


Note

If the date is formatted for a locale other than the English (US) locale, you must use the LSParseDateTime function, then 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.


Example

<!--- This example shows the use of ParseDateTime--->

<html>

<head>

<title>

ParseDateTime Example

</title>

</head>



<body bgcolor = silver>

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

...







Banner.Novgorod.Ru