0

Is there a way to convert this:

Tue Aug 28 13:59:01 +0000 2012

Into a DateTime Object?

I need to diff the above value with a DateTime Object.

1
  • Um I guess I am confused because that's not a Unix timestamp...do I have to parse that date out into a Unix Timestamp first? Aug 28, 2012 at 14:41

2 Answers 2

1

Just pass it into the DateTime constructor...

$date = new DateTime('Tue Aug 28 13:59:01 +0000 2012');
echo $date->format('Y-m-d H:i:s');
0
$date = new DateTime($yourDate);

this will covert to standard DateTime object

check php manual here . Example 2 will make it clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.