Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP equivalent of UNIX_TIMESTAMP() of MySQL?

In MySQL:

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

I need to get the value from PHP.

like image 840
user198729 Avatar asked Dec 08 '09 12:12

user198729


1 Answers

echo time();

or

echo strtotime('now');
  • http://php.net/manual/en/function.time.php
  • http://php.net/manual/en/function.strtotime.php

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');
like image 171
karim79 Avatar answered Nov 03 '22 03:11

karim79