jamcoupe
jamcoupe

Reputation: 1452

php not outputing a ISO timestamp from mongoDB the format I need

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.

Upvotes: 0

Views: 702

Answers (1)

deceze
deceze

Reputation: 522597

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.

Upvotes: 1

Related Questions