Convert human readable date to unix timestamp date

Convert human readable date to unix timestamp date

To convert a date in the format YYYY-MM-DD HH:MM:SS to a purely numeric date (i.e., a timestamp), you need to use the MySQL function UNIX_TIMESTAMP.

Example:

SELECT UNIX_TIMESTAMP('2017-05-22 14:20:05') `new_date`

Result — 1495452005

The same query, but without the time part:

SELECT UNIX_TIMESTAMP('2017-05-22') `new_date`

Result — 1495400400

Are you having problems with your WordPress site? Do you need additional functionality? A custom plugin or a new page?
Then write to me via the feedback form, and I will try to help you.

Write a comment

Your email address will not be published. Required fields are marked *