Jump to content

get datetime from string


ohdang888

Recommended Posts

I'm given something like this:

Sun Nov 06 2011 09:30:00 GMT-0500 (EST)

 

And i'm trying to turn that into

2011-11-06 09:30:00

 

I started by using explode and trying to loop through the day and month to figure it out, but that seems inefficient and overly complicated. Am i missing something?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/251037-get-datetime-from-string/
Share on other sites

 

Thanks! knew it should that simple.

 

BUT from that exact string i'm getting this time:

using Sun Nov 06 2011 09:30:00 GMT-0500 (EST)

getting 2011-11-06 4:30:00

 

using

<?php echo date('Y-m-d G:i:s', strtotime(url_decode($_GET["start"]))); ?>

 

I changed the timezone to EST, and its still coming up with the same thing. I've tried messing around with it, but not getting it to work. How do i adust for this difference? thanks

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.