Skip to content

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:

  1. User-Provided Format – If a format string is provided in the formula, it is used directly.

  2. Application-Level Culture Setting – If no format string is provided, the application retrieves the culture settings from the server configuration.

  3. 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

  1. =CTODAY() - Returns the current date and time using the default format.
  2. =CTODAY("dd/MM/yyyy") - Returns the current date in the format day/month/year.
  3. =CTODAY("dd/MM/yyyy", 60) - Returns the current date in day/month/year format and adjusts the time by adding 60 minutes (1 hour).
  4. =CTODAY("", 120) - Uses the default format but adjusts the time by adding 120 minutes (2 hours).
  5. =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.
  6. =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.
  7. =CTODAY("dd-MMM-yyyy") - Returns the current date formatted as day-month-year, with the month displayed as a three-letter abbreviation.
  8. =CTODAY("dd/MMM/yyyy hh:mm:ss tt") - Returns the full date and time in the format day/abbreviated-month/year hours:minutes:seconds AM/PM.
  9. =CTODAY("dd/MMM/yyyy HH:mm:ss") - Returns the full date and time in the 24 hours format day/abbreviated-month/year Hours:minutes:seconds.
Back to top