getDateDMYFormat( )
Return a date or datetime in DD-Mon-YYYY format, including time elements if applicable. This function supports partial dates.
Syntax
getDateDMYFormat(vDate, [timeFormat])
Parameters
- vDate
-
Required. Rule variable of date or datetime type.
- timeFormat
-
Optional. Specifies the output format for the time elements present. This can be one of the following values (case-sensitive), all in a 24-hour format:
"HH:mm:ss"
"HH:mm"
"HH"
timeFormat
is not supplied, the return value will include all available time elements, suppressing any ending zero values. For example, ifvDate
contains a full time including hours, minutes and seconds the output will have a "HH:mm:ss" time format, and if it only contains hours then output will have a "HH" format. However, if time equals"07:45:00"
, output will omit the seconds and return"07:45"
, but would not remove the minutes in"07:00:45"
as the ending value present is "45" for the seconds time element.Note:
Previously, this function used to take an optional boolean value as the second parameterisPartial
, to specify whether the function is expecting a partial date or not. This function still acceptstrue
andfalse
as the second parameter, instead of thetimeFormat
parameter, to continue supporting existing rules.
Return value
Date in DD-Mon-YYYY, for example UNK-Jan-2025 or 01-Feb-2021 23:45:00.
Example 3-38 Return a partial date in DD-Mon-YYYY format
var mdyDate = getDateDMYFormat(vDate);
return mdyDate.toString();
// returns date as string "UNK-Jan-2025"
Parent topic: Date and time functions