HOUR() Examples – MySQL

The MySQL HOUR() function is used to return the hour component from a time value.

The return value for a time-of-day value will be between 0 and 23, however the range returned by this function could be much larger, due to the fact that a time data type isn’t limited to just a time of day (it can also be used to represent elapsed time or a time interval between two events). This means that the returned value could be greater than 24 hours or even a negative value.

Read more

FROM_UNIXTIME() Examples – MySQL

The MySQL FROM_UNIXTIME() function enables you to return a date representation of a Unix timestamp.

More specifically, it returns the Unix timestamp as a value in ‘YYYY-MM-DD HH:MM:SS’ or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

Read more

UNIX_TIMESTAMP() Examples – MySQL

In MySQL, you can use the UNIX_TIMESTAMP() function to return a Unix timestamp. A Unix timestamp is the number of seconds that have elapsed since ‘1970-01-01 00:00:00’ UTC.

You can use this function to return a Unix timestamp based on the current date/time or another specified date/time.

Read more

EXTRACT() Examples – MySQL

In MySQL, you can use the EXTRACT() function to extract parts from a date. For example, you can extract the year part, the month part, or the day part, etc. You can also extract parts from the time component, such as minutes, seconds, microseconds, etc.

This article contains examples to demonstrate.

Read more