Jump to content

convert a date to Timestamp.


ajoo

Recommended Posts

Hi guys, 

 

I found that this much asked question on the net has no real straight forward answer. So i ask this again.

 

$date = ('2013-07-08 12:30:30');

 

how can i change this date to a Unix time stamp in the simplest possible manner just as it is possible to convert a timestamp to  datetime in one line.

 

Thanks to all again.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/281052-convert-a-date-to-timestamp/
Share on other sites

Thank you sir !! 

 

In fact i found another method which I'll post here

 

echo strtotime('2011-02-27 02:04:46');             // 1  SAME AS BARAND - THANKS

$dt = new DateTime('2011-02-27 02:04:46');         // 2 
echo $dt->format('U');

 

Thnaks loads. hope this will help some more like me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.