LassoScript Utility
Basics Browse Detail


Tag Link [Valid_Date] Category Utility
Type Substitution Source Available No
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type Boolean Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0


[Valid_Date] checks whether a string contains a valid date or not. The tag returns True if the parameter is in a format that Lasso can parse or False otherwise.

Built-in date formats include U.S. date format '7/4/2003 12:34:56', MySQL date format '2003-07-04 12:34:56' and others. See the [Date] tag for a full list of supported formats.

If an optional -Format parameter is specified then the date string will be checked against that format. See the [Date] tag for a full list of tokens which can be used in the -Format parameter.


[If: (Valid_Date: '12/31/1987')] ... [/If]

[If: (Valid_Date: '1987-12-31')] ... [/If]

[If: (Valid_Date: '31|1987|12', -Format='%d|%Y|%m')] ... [/If]


Required Parameters
Date String The date string to be inspected.
Optional Parameters
-Format Optional format to check the date string against.


To check whether a tag is valid:

Use the [Valid_Date] tag. The following example tests several different dates to see if they are valid or not. Either True or False is returned for each test.

[Valid_Date: '12/25/2003']
[Valid_Date: 'Christmas']
[Valid_Date: '2003-12-25 1:35:35']