AsDate
Converts a value into a date using the format specified after the argument.
Contents
Example One
Convert a fixed value. Databox CompanyData.Expressions.Date holds the value 15-10-2016 and using Examples.Date.AsDate in the message Expressions.EXPDATE it is converted into the format "ddd dd MMM yyyy"
Setup
The fixed value to be converted.
This is the expression to convert it to a different format. Using the correct formats shown on the Date Expressions page, you can convert this date into almost limitless formats.
The message applies the expression and displays it as seen below.
Example Two
Convert a user entered date. This example follows the same format as the first but using a date entered by the user rather than a fixed value.
Demonstration
Example Three
Convert 24 hour time to 12 hour time. User enters time in the 24 hour format "HH:mm" and it is converted into and displayed as 12 hour time "hh:mm tt"
- The user enters the time in question Time01
- This is written into Examples.Date and then evaluated against Examples.Date.AsDate 24H->12H
- The result is written into Script.Info01 and displayed in the message Expressions.EXPDATE08
Setup
Demonstration
Below the script has been run twice, once with an PM time and once with a AM time.