Date and Time Functions
The eServices Field Codes include the following date/time functions:
Date
Description
Returns a Date/Time constructed from individual components or a string.
Syntax
Date(Year, Month, Day
[, Hour[, Minute[, Second
]]])
Or
Date(String[, String])
Argument |
Description |
First argument |
The string to parse. |
Second argument |
Optional. The locale that must be used to parse the first segment. Some examples include: en_US for English (United States), en_GB for English (United Kingdom), and fr_FR for French (France). See See Values for fieldcode-format-locale Option for a complete list. |
Remarks
- When using the first syntax function, the optional arguments each default to 0 if omitted. For example, <$Date(1965, 11, 23)$> is equivalent to <$Date(1965, 11, 23, 0, 0, 0)$>.
- When using the second syntax function, the date is constructed by parsing the first string. If the optional argument is omitted, first the E-mail Server fieldcode-format-locale option (See fieldcode-format-locale) in the email-processing section is used if present. Otherwise, the platform locale is used. For example:
- <$Date("November 23, 1965 9:03 AM")$> if the fieldcode-format-locale option or platform locale is set to en_US.
- <$Date(“23 novembre 1965 21:03:00”, “fr_FR”)$>
Day
Description
Returns the numeric day component of a Date/Time (1 to 31)
.
Syntax
Day(DateTime
)
Hour12
Description
Returns the numeric hour component of a Date/Time based on a 12-hour clock (1 to 12)
.
Syntax
Hour12(DateTime
)
Hour24
Description
Returns the numeric hour component of a Date/Time based on a 24-hour clock (0 to 23)
.
Syntax
Hour24(DateTime
)
IsAm
Description
Returns a Boolean indicating whether a specified Date/Time is AM (between midnight and noon). True indicates AM and False indicates PM.
Syntax
IsAm(DateTime
)
IsPm
Description
Returns a Boolean indicating whether a specified Date/Time is PM (between noon and midnight). True indicates PM and False indicates AM.
Syntax
IsPm(DateTime
)
Minute
Description
Returns the numeric minute component of a Date/Time (0–59)
.
Syntax
Minute(DateTime
)
Month
Description
Returns the numeric month component of a Date/Time (1–12)
.
Syntax
Month(DateTime
)
MonthName
Description
Converts a month number or a Date/Time to a month name.
Syntax
MonthName(Arg[, String])
Argument |
Description |
First argument |
If it is a numeric value (1 to 12
), it is converted to the appropriate month name. If it is a Date/Time, the month number is extracted and converted. |
Second argument |
Optional. The locale that must be used to format the first argument. Some examples include: en_US for English (United States), en_GB for English (United Kingdom), and fr_FR for French (France). See See Values for fieldcode-format-locale Option for a complete list. |
Remarks
If the optional argument is omitted, first the E-mail Server fieldcode-format-locale option (See fieldcode-format-locale) in the email-processing section is used if present. Otherwise, the platform locale is used.
MonthNameShort
Description
The same as the MonthName, but this returns an abbreviated version of the month name instead.
Syntax
MonthNameShort(Arg[, String])
Argument |
Description |
First argument |
If it is a numeric value (1 to 12
), it is converted to the appropriate abbreviated name. If it is a Date/Time, the month number is extracted and converted. |
Second argument |
Optional. The locale that must be used to format the first argument. Some examples include: en_US for English (United States), en_GB for English (United Kingdom), and fr_FR for French (France). See See Values for fieldcode-format-locale Option for a complete list. |
Remarks
If the optional argument is omitted, first the E-mail Server fieldcode-format-locale option (See fieldcode-format-locale) in the email-processing section is used if present. Otherwise, the platform locale is used.
Second
Description
Returns the numeric second component of a Date/Time (0–59)
.
Syntax
Second (DateTime
)
Time
Description
Returns a Date/Time constructed from individual time components.
Syntax
Time ([Hour, [Minute, [Second
]]])
Remarks
The date components of the result (year, month, and day) are set to the current system date. The optional arguments default to 0 if omitted. If all the optional arguments are omitted, then the time is set to the current system time.
Example |
Result |
<$Time()$> |
2003-11-23 09:03:10
|
<$Time(15)$> |
2003-11-23 15:00:00
|
<$Time(15, 23, 10)$> |
2003-11-23 15:23:10
|
TimeGMT()
Description
Returns a Date/Time set to the current system time and converted to GMT (Greenwich mean time), also called Universal Time Coordinated, or UTC.
Syntax
TimeGMT()
ToTimeZoneDate
Returns a Date/Time constructed from a string and a time zone.
Syntax
ToTimeZoneDate(DateString, TimeZoneString)
Remarks
This date is constructed by parsing the <DateString> string and using the specified time zone <TimeZoneString>
. Examples include the following:
<$ToTimeZoneDate(Date(“November 23, 1965 9:03 AM”), “America/Los_Angeles”)$>
<$ToTimeZoneDate(Date(“11/23/65 9:03:00”), “Europe/Paris”)$>
Weekday
Description
Returns the numeric weekday component of a Date/Time (0 = Sunday to 6 = Saturday).
Syntax
Weekday (DateTime
)
WeekdayName
Description
Converts a number of a Date/Time to a weekday name.
Syntax
WeekdayName(Arg[, String])
WeekdayName String
|- valign="top"
| rowspan="1" colspan="1" |
Argument
| rowspan="1" colspan="1" |
Description
|- valign="top"
| rowspan="1" colspan="1" |
First argument
| rowspan="1" colspan="1" |
If it is a numeric value (0 to 6
), it is converted to the appropriate weekday name. If it is a Date/Time, the weekday number is extracted and converted.
|- valign="top"
| rowspan="1" colspan="1" |
Second argument
| rowspan="1" colspan="1" |
Optional. The locale that must be used to format the first argument. Some examples include: en_US for English (United States), en_GB for English (United Kingdom), andfr_FR for French (France). See See Values for fieldcode-format-locale Option for a complete list.
|}
Remarks
If the optional argument is omitted, first the E-mail Server fieldcode-format-locale option (See fieldcode-format-locale) in the email-processing section is used if present. Otherwise, the platform locale is used.
WeekdayNameShort
Description
The same as WeekdayName but this returns an abbreviated weekday name instead.
Syntax
WeekdayNameShort(Arg[, String])
WeekdayNameShort String
|- valign="top"
| rowspan="1" colspan="1" |
Argument
| rowspan="1" colspan="1" |
Description
|- valign="top"
| rowspan="1" colspan="1" |
First argument
| rowspan="1" colspan="1" |
If it is a numeric value (0 to 6
), it is converted to the appropriate abbreviated weekday name. If it is a Date/Time, the weekday number is extracted and converted.
|- valign="top"
| rowspan="1" colspan="1" |
Second argument
| rowspan="1" colspan="1" |
Optional. The locale that must be used to format the first argument. Some examples include: en_US for English (United States), en_GB for English (United Kingdom), and fr_FR for French (France). See See Values for fieldcode-format-locale Option for a complete list.
|}
Remarks
If the optional argument is omitted, first the E-mail Server fieldcode-format-locale option (See fieldcode-format-locale) in the email-processing section is used if present. Otherwise, the platform locale is used.
Year
Description
Returns the numeric year component of a Date/Time with the century.
Syntax
Year (DateTime
)
YearShort
Description
Returns the numeric year component of a Date/Time without the century (0
– 99
).
Syntax
YearShort (DateTime
)