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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.