Date and Time Functions

Date and Time Functions

Click the link or image to navigate to an article on each function or check out the video on how to use a date and time function.

Watch the video




COUNT_DAYS Returns the number of whole days between the given start and end dates, excluding any identified dates.

Start date and end date parameters must be in epoch (numeric) format.

   example: COUNT_DAYS( 1420070400, 1420416000 ) returns 5
DATE Converts a date parameter (must be a text date string) to epoch (numeric) format.

example: DATE( 01/01/2015, dd/MM/yyyy ) returns 1420070400
DATE_ADD Adds or subtracts the given unit amount to the date parameter (must be in epoch (numeric) format) and returns the resulting date in epoch format. To subtract, set amount to a negative value.

   example: DATE_ADD( TODAY(), day, -7 ) returns the epoch value for 1 week ago
DATE_CLOSEST Returns the date (in epoch format) of the dow (day of week) closest to the date given as a parameter (in epoch format). Direction is either forward (default) or backward.

   example: DATE_CLOSEST( 1420070400, Sunday ) returns 1420329600
DATE_CONVERT Converts a date from one text date string format to another text date string format.

   example: DATE_CONVERT( 01/01/15, dd/MM/yy, MMM dd, yyyy) returns Jan 01, 2015
DATE_ENDOF Returns the date (in epoch format) at the end of the given unit (week, month, quarter, year) containing the date provided (in epoch format).

   example: DATE_ENDOF( 1420070400, week ) returns 1420070400
DATE_IN Returns true if the date provided (in epoch format) is contained in the same time period specified by unit (day, week, month, quarter, year) as the relative time period (default is 0) and returns false otherwise.

   example: DATE_IN ( 1420070400, month, -2 ) returns true if 1420070400 is in the same month as 2 months ago.
DATERANGE Returns all dates between the specified start and end dates. The start and end dates must be in the same format, specified by format.

   example: DATERANGE( 01012015, 28022015, ddMMyyyy)
DATE_SET Sets time units to specific values for each of the given dates
DATE_STARTOF Returns the date (in epoch format) at the start of the given unit (week, month, quarter, year) containing the date provided (in epoch format).

   example: DATE_STARTOF( 1420070400, week ) returns 1419724800
DATE_UNITVALUE Retrieves the value of the given unit from the given dates
DATEVALUE Converts an epoch (numeric) date to a text date string in the specified format.

   example: DATEVALUE( 1420070400, dd MMM yy ) returns 01 Jan 15
NOW Returns the current epoch (numeric) date and time.
TODAY Returns the current epoch (numeric) date for today.
YESTERDAY Returns the current epoch (numeric) date for yesterday.


  1. Introduction: Using formulas
  2. Data Manipulation functions
  3. Logic functions
  4. Math functions
  5. SELECT function
  6. Text Functions
  7. Date and Time Functions
  8. Statistics Functions
  9. ABS function
  10. AND function
  11. ARRAY function
  12. AVERAGE function
  13. BETWEEN function
  14. BLANK function
  15. CAPITALIZE function
  16. CEILING function
  17. CONCAT function
  18. CONTAINS function
  19. COUNT function
  20. COUNTALL function
  21. COUNTBLANK function
  22. COUNTDISTINCT function
  23. COUNTIF function
  24. COUNT_DAYS function
  25. COUNTNUMERIC function
  26. CUMULATIVE function
  28. DATASOURCE function
  29. DATE and DATEVALUE functions
  30. Using Date and Time Formats
  31. DATERANGE function
  32. DATE_ADD function
  33. DATE_CLOSEST function
  34. DATE_CONVERT function
  35. DATE_ENDOF function
  36. DATE_IN function
  37. DATE_SET function
  38. DATE_STARTOF function
  39. DATE_UNITVALUE function
  40. FLOOR function
  41. ERF function
  42. FIRST function
  43. ERFC function
  44. GROUP and GROUPBY functions
  45. IF function
  46. IN function
  47. INDEXOF function
  48. JOIN function
  49. LAST function
  50. LASTINDEXOF function
  51. LEFT function
  52. LOOKUP function
  53. LOWER function
  54. MAP function
  55. MAX function
  56. MIN function
  57. MEDIAN function
  58. MOD function
  59. MODE function
  60. Moving Average (Cumulative)
  61. Moving Average (Exponential)
  62. Moving Average (Simple)
  63. NORMSDIST function
  64. NOT function
  65. NOW function
  66. NUMBERFORMAT function
  67. OR function
  68. PADVALUES function
  69. POWER function
  70. RANK function
  71. REMOVE_EMOJI function
  72. REPEAT function
  73. REPLACE function
  74. REVERSE function
  75. RIGHT function
  76. ROUND function
  77. SET function
  78. SLICE function
  79. SLOPE function
  80. SORT function
  81. SPLICE function
  82. STANDARDIZE function
  83. STDEV function
  84. STDEVP function
  85. SUBSTITUTE function
  86. SUBSTITUTE_REGEX function
  87. SUBSTRING function
  88. SUM function
  89. SUMIF function
  90. SWITCH function
  91. TEXT_REVERSE function
  92. TODAY function
  93. TRIM function
  94. TRUNCATE function
  95. UPPER function
  96. URLDECODE function
  97. URLENCODE function
  98. VARIANCE function
  99. VARIANCEP function
  100. YESTERDAY function
  101. ZTEST function

Feedback and Knowledge Base