target.InitDate
Description
Initializes a date value from a text date string according to a provided format.
Syntax
Function InitDate(text, format)
Parameters
string text - a text date string
string format - the date format description ("MM/DD/YYYY", "DDDD, MMMM DD, YYYY", etc. See date and numeric formats for more information)
- The masks for time parsing are:
h:m:s (24 hours time)
h:m:s p (12 AM/PM time)
Return value
date - a date value initialized from the text using the specified format
Example
Sample code
Function OnRecord
Dim str, dt
str = "01/01/2012"
dt = Trg.InitDate(str, "DD/MM/YYYY") 'for euro date format
dt = Trg.InitDate(str, "MM/DD/YYYY") 'for USA date format
Function OnRecord
Dim str, dt
str = "10/11/2011 11:12:34 pm"
dt = trg.InitDate(str, "M/D/YYYY h:m:s p")
Function OnRecord
Dim str, dt
str = "10/11/2011 14:12:34"
dt = trg.InitDate(str, "M/D/YYYY h:m:s")
See also