CTODAY¶
The CTODAY
formula returns the current date and/or time, formatted according to the specified format string and adjusted by the specified timezone offset. This formula is useful for displaying the current date and time in various formats within your report.
Syntax
CTODAY (FormatString, TimezoneOffsetOverride)
Arguments¶
FormatString : string
(optional)¶
The format in which the date and/or time should be returned. If omitted, a default format will be applied based on the following precedence:
-
User-Provided Format – If a format string is provided in the formula, it is used directly.
-
Application-Level Culture Setting – If no format string is provided, the application retrieves the culture settings from the server configuration.
-
Server Culture – If the application-level setting is not available, the system falls back to the culture of the server where the code is being executed.
TimezoneOffsetOverride : int
(optional)¶
Specify the timezone offset in minutes. This value will be added to the current timezone offset to adjust the displayed time. If not provided, the current timezone offset will be used.
Usage Scenarios¶
This formula is useful for retrieving the current date and time while allowing customization of the format and timezone offset. It is particularly helpful in reporting scenarios where consistent date-time formatting is required across different users and regions.
Examples¶
=CTODAY()
- Returns the current date and time using the default format.=CTODAY("dd/MM/yyyy")
- Returns the current date in the formatday/month/year
.=CTODAY("dd/MM/yyyy", 60)
- Returns the current date inday/month/year
format and adjusts the time by adding 60 minutes (1 hour).=CTODAY("", 120)
- Uses the default format but adjusts the time by adding 120 minutes (2 hours).=CTODAY("", 1440)
- Applies the default date and time format, while incrementing the time component by 1440 minutes, effectively adding 24 hours or one day to the current date and time.=CTODAY("", -1440)
- Applies the default date and time format, while decrementing the time component by 1440 minutes, effectively subtracting 24 hours or one day to the current date and time.=CTODAY("dd-MMM-yyyy")
- Returns the current date formatted asday-month-year
, with the month displayed as a three-letter abbreviation.=CTODAY("dd/MMM/yyyy hh:mm:ss tt")
- Returns the full date and time in the formatday/abbreviated-month/year hours:minutes:seconds AM/PM
.=CTODAY("dd/MMM/yyyy HH:mm:ss")
- Returns the full date and time in the 24 hours formatday/abbreviated-month/year Hours:minutes:seconds
.