3.12.5Framework.FormatDate()

FormatDate() formats a date, by default in the format yyyy/mm/dd hh:mm:ss

Parameter

Description

datetime

Date/time to format. Although the framework's standard representation of date/times is milliseconds, you are allowed to pass a Javascript Date object into this function.

options

Options for formatting the date

The possible options for FormatDate() are as follows:

Option

Description

format

String describing the format for the date. If omitted, or none of the items below, then the format is yyyy/mm/dd hh:mm:ss.

"dateonly": formats as yyyy/mm/dd, i.e. no time component

"yyyymm": formats as yyyy/mm, i.e. no day or time

"timeonly": formats as hh:mm:ss, i.e. no date component

"timehhmm": formats as hh:mm, i.e. no date component and no seconds

"datehhmm": formats as yyyy/mm/dd hh:mm, i.e. a full date-time, but without the seconds

"textdate": language specific, but in English formats as dddd d mmmm yyyy, e.g. Saturday 12 December 2020 (no time component)

localtime

By default, FormatDate() uses the UTC properties of the date: getUTCHours(), getUTCMonth() etc. Setting localtime:true tells it instead to use getHours(), getMonth() etc - which therefore converts the date/time from UTC to the user's local time zone

date_separator

Can be used to override the separator between the parts of the date. Defaults to /

time_separator

Can be used to override the separator between the parts of the time. Defaults to :