@TextToTime (JavaScript)

Converts a string to a date and time.

Defined in

@Functions (JavaScript)

Syntax

@TextToTime(value:string) : Date
Parameter Description
value A string that represents a date and time in locale format.
Return value Description
Date The equivalent date and time, or an empty string if the parameter string cannot be converted. If the date can be converted but the time cannot be converted or is missing, the time appears as 0 hours.

Examples

This example demonstrates the conversion of various strings to dates.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

function printDate(d) {
	p("Text = " + d);
	p("Year = " + @Year(@TextToTime(d)));
	p("Month = " + @Month(@TextToTime(d)));
	p("Day = " + @Day(@TextToTime(d)));
	p("Hour = " + @Hour(@TextToTime(d)));
	p("Minute = " + @Minute(@TextToTime(d)));
	p("Second = " + @Second(@TextToTime(d)));
}

printDate("4/1/06");
printDate("04/01/2006");
printDate("04/01/2006 1:05 PM");