Date in this format "YYYYMMDD"


Can any one please let me know how to get this date format YYYMMDD. i.e todays date is 6 August 2009. and the date format should return me 20090806.

is there any predefined function to fetch me the date in this format, or can we set the dateformat to this format : ‘yyyymmdd’.

Please let me know in case of any further information required.

Thanks in advance

The format string for this is “%Y%m%d”. You can use this format in the formattedTime function for one-time use:

put formattedTime("%Y%m%d") -- 20090806
put formattedTime("%Y%m%d", "July 4") -- 20090704

Or, if you want that format used as the standard date format you can do it like this:

set the to "%Y%m%d" -- change the date format
put the date -- 20090806
put date("July 4, 1776") -- 17760704