asDate(): Date;
The asDate method of the StringUtf8 primitive type returns a date based on the contents of the receiving string.
If the receiving string does not contain a valid date, "invalid" is returned.
The data value must represent one of the following date formats.
dd-MMM-yy (for example, 30-Aug-11)
dd/MM/yy (for example, 30/08/11)
MMM dd, yy (for example, Aug 30, 11)
yyyy:MM:dd (for example, 2011:08:30)
Any non-alphanumeric character can be used as a delimiter.
JADE converts a two-digit year as follows.
If the current year is equal to or less than 50, all dates default to the current century.
If the current year is greater than 50, dates that have a year greater than 50 default to the current century.
If the current year is greater than 50, dates equal to or less than 50 default to the next century.
Always use four-digit years in your applications.
The following example shows the use of the asDate method.
vars dateValue : Date; begin dateValue := @"15 May 2010".asDate; // 15 May 2010 dateValue := @"15-May-2010".asDate; // 15 May 2010 dateValue := @"15/5/2010".asDate; // 15 May 2010 dateValue := @"May 15, 2010".asDate; // 15 May 2010 dateValue := @"2010:5:15".asDate; // 15 May 2010 dateValue := @"29/2/2011".asDate; // "*invalid*" end;