Lasso Soft Inc. > Home

[Date_Format]

[Date_Format] outputs a Lasso date string in any format.

The first parameter should be in Lasso date format. The -DateFormat keyword/value parameter defines how the date should be formatted.

%D U.S. date format: (mm/dd/yy).
%r 12-hour time format (hh:mm:ss [AM/PM]).
%T 24-hour time format (hh:mm:ss).
%Y 4-digit year.
%y 2-digit year.
%m Month number (1=January, 12=December).
%B Full English month name (e.g. "January").
%b Abbreviated English month name (e.g. "Jan").
%d Day of month (1-31).
%w Day of week (1=Sunday, 7=Saturday).
%A Full English weekday name (e.g. "Wednesday").
%a Abbreviated English weekday name (e.g. "Wed").
%H 24-hour time hour (0-23).
%h 12-hour time hour (1-12).
%M Minute (0-59).
%S Second (0-59).
%p AM/PM for 12-hour time.
%z Time zone offset in relation to GMT (e.g. -0800).
%% A percent sign.

By default, all output is zero padded to two characters. For example, 02/03/2002.

A hyphen - between the % and the letter code instructs Lasso not to pad the output. For example, 2/3/2002

An underscore _ between the % and the letter instructs Lasso to pad the output with spaces. For example, 2/ 3/2002.

  • Syntax
  • Parameters
[Date_Format: Base Date
  -DateFormat=Date Format]
Required Parameters
Base Date The date to be formatted in Lasso Date format.
-DateFormat A string specifying how the date should be formatted.
Optional Parameters
Encoding Keyword Specifies the encoding for the tag's return value. Tags are encoded using -EncodeHTML by default if their value is output in a format file. No encoding is applied to nested tags unless an explicity encoding keyword is specified. One of -EncodeBreak, -EncodeHTML, -EncodeNone, -EncodeRaw, -EncodeSmart, -EncodeStrictURL, -EncodeURL, -EncodeXML.
Examples

To format a date for MySQL:

Use the [Date_Format] tag with an appropriate -DateFormat parameter. The format for MySQL dates is %Y-%m-%d %H:%M:%S. The following example converts the current date and time into MySQL date/time format.

[Date_Format: (Date_GetCurrentDate), -DateFormat='%Y-%m-%d %H:%M:%S']
Result:
2001-03-04 12:34:56
Tag Link [Date_Format] Category Date
Type Substitution Data Source Any
Support Preferred Version 3.0
Output Type String Security None
Implementation Sets Lasso 5.0,LDML3x

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft