Lasso Soft Inc. > Home

[ Date_Format ]


[Date_Format] outputs a Lasso date object in a specified format.

The method requires a date object as its first parameter, and a format string as its second parameter which defines how the date should be formatted. This method does not support locales and the [Date->Format] method should be used if locales are needed.

By default, all input is assumed to be zero padded to two characters. For example, 02/03/2011.

A hyphen - between the % and the letter code instructs Lasso not to look for padding. For example, 2/3/2011

An underscore _ between the % and the letter instructs Lasso to to look for padding with spaces. For example, 2/ 3/2011.

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

To format a date object in a specified format:

Use the [Date_Format] method. The following example formats a date as a MySQL timestamp.


date_format('2011-02-19 16:33:48', '%q')



Recent Comments

No Comments found

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