0

I need to have a time stamp that is like this: 2008-01-28T20:24:17Z for a jQuery plugin however when I try to retrieve the date from a mongoDB using:

<?php print date('c', $article['created_at']->sec);?>

I get this back: 2012-01-24T19:20:12+00:00

Does anyone know how to change the timestamp to match the first ones formatting.

1 Answer 1

1
print date('Y-m-d\TH:i:s\Z', $article['created_at']->sec);

Both forms are valid for ISO 8601 dates though, if a program can parse one, it should be able to parse the other as well.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I had to have it in this format for this plugin prettydates

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.