How UTC_DATE() Works in MariaDB

In MariaDB, UTC_DATE() is a built-in date and time function that returns the current UTC date.

The result is returned in ‘YYYY-MM-DD’ or YYYYMMDD format, depending on whether the function is used in a string or numeric context.

UTC stands for Coordinated Universal Time, and is the world standard for regulating time.

Read more

How UNIX_TIMESTAMP() Works in MariaDB

In MariaDB, UNIX_TIMESTAMP() is a built-in date and time function that returns a Unix timestamp, based on its argument (or lack of argument).

It works like this:

  • When called without an argument, it returns a Unix timestamp (seconds since ‘1970-01-01 00:00:00’ UTC) as an unsigned integer.
  • When called with an argument, it returns the value of the argument as seconds since ‘1970-01-01 00:00:00’ UTC.

The inverse function of UNIX_TIMESTAMP() is FROM_UNIXTIME().

Read more

How TIMESTAMP() Works in MariaDB

In MariaDB, TIMESTAMP() is a built-in date and time function that returns a datetime value, based on its argument/s.

It can be used with either one argument or two, as follows:

  • When used with one argument, it returns that date or datetime expression as a datetime value.
  • When used with two arguments, it adds the second (time) argument to the first (date or datetime) expression, then returns the resulting datetime value.

Read more