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

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.