| Operator Type: | Function |
| Operator Scope of Action: | Item |
| Operator Purpose: | Date-time |
date(string)
constructs a date from a quoted string or string expression. Usually, this is not necessary; Tinderbox will coerce the string to a date type automatically. In some contexts though, it may be more convenient or more clear to make the conversion explicit. (See format to convert dates into strings).
This operator creates actual Date-type data, which the examples below are actually coercing back into a string! Note too that the examples below were output from a system with UK setting, thus using day-month order. For reference, month-day order is actually only used in the USA and the Philippines - the rest of the world uses day-month, though the delimiters used in text can vary (slosh, colon, dot, etc.). The action code shown is being exported via ^value()^.
Default: date("24/10/2009") gives 24/10/2009 20:37; note how the hh:mm current at export get added. The resulting string is the same as you see for a date displayed as a key attribute. The exact format will depend on the users international settings. Although seconds aren't shown, they do get set.
Provide a time: date("24/10/2009 01:30:00") gives 24/10/2009 01:30; the specified time gets used.
Provide a date formatting string: format(date("24/10/2009 01:30:00"),"*") gives Sat, 24 Oct 2009 01:30:00 +0100; note the change of format.
In the last example note how the format() operator wraps date() and not vice versa.
