PHP equivalent of UNIX_TIMESTAMP() of MySQL?

17,717

Solution 1

echo time();

or

echo strtotime('now');

strtotime will:

Parse about any English textual datetime description into a Unix timestamp

So you might just try:

echo strtotime('2009-12-08 21:01:33');

Solution 2

strtotime()

Share:
17,717
user198729
Author by

user198729

Updated on June 06, 2022

Comments

  • user198729
    user198729 about 2 years

    In MySQL:

    select UNIX_TIMESTAMP('2009-12-08 21:01:33') ;
    

    I need to get the value from PHP.