Date & Time​

Built-in utility functions for working with dates and time

Please refer to this guide before using the Date and Time functions. Due to certain limitations, the behavior of these functions can differ from their SQL counterparts with the same name. All dates use microsecond precision.


Returns current DateTime. Both functions are equivalent, GETDATE() is the SQL Server and Now() the MySQL name.


Parses a string and returns it as DateTime. Accepts various formats, ie. “2020-01-02 03:04:05.000”.


Returns the date part of the DateTime, ie. turns “2020-01-02 03:04:05.000” into “2020-01-02 00:00:00.000”.


Returns the difference between two dates in days.


Returns a part of the date as specified by the first parameter. Unlike in SQL, the first parameter is a string.

  • “year”, “yy”, “yyyy” – Year
  • “month”, “mm”, “m” – Month
  • “dayofyear”, “dy”, “y” – Day of year
  • “day”, “dd”, “d” – Day of month
  • “weekday”, “dw”, “w” – Day of week
  • “hour”, “hh” – Hour
  • “minute”, “mi”, “n” – Minute
  • “second”, “ss”, “s” – Second
  • “millisecond”, “ms” – Millisecond
  • “microsecond”, “mcs” – Microsecond
  • “nanosecond”, “ns” – Nanosecond