Jump to content

Date Format - Mon Jul 28 04:16:22 +0000 2008 - What is this?


Recommended Posts

That isn't really a defined code format at all, but you may be able to parse it (although, the time provided would be 4:15am). Try something like this:

<?php
$ts = 'Mon Jul 28 04:16:22 +0000 2008';
if (preg_match('|^([a-z]{3})\s([a-z]{3})\s(\d+)\s(\d+\:\d+\:\d+)\s\+\d+\s(\d{4})$|i', $ts, $match))
{
  $str = "$match[1] $match[2] $match[3], $match[5] $match[4]";
  echo date('l, F j, Y \a\t g:i a', strtotime($str));
}
?>

 

Hope this helps.

Where are you running the code from? From your website? If so, the server your site is hosted on is most probably in a different timezone than you. The date/time PHP outputs is in relation to the servers timezone.

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.