UTC_TIMESTAMP() Examples – MySQL

In MySQL, you can use the UTC_TIMESTAMP function to return the UTC date and time. UTC stands for Coordinated Universal Time and it’s the primary time standard by which the world regulates clocks and time.

The result of this function is returned either in ‘YYYY-MM-DD HH:MM:SS’ or YYYYMMDDHHMMSS format, depending on whether it’s used in a string or numeric context.

Continue reading

TIME_TO_SEC() Examples – MySQL

When using MySQL, you can use the TIME_TO_SEC() function to return the number of seconds in a time value. Specifically, this function returns the time argument, converted to seconds.

This function is not to be confused with the TO_SECONDS() function, which, given a date or datetime argument, returns the number of seconds since year 0.

Here’s how TIME_TO_SEC() works.

Continue reading