Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the time format used in facebook created date?

Hi i am working on facebook Graph API where i need all the posts information of a group. So I did it and saw [created_date'] => '2013-01-25T00:11:02+0000' what does this date and time represent i mean i know 2013-01-25 is date and 00:11:02 is time but what does T and +0000 represent.

BTW where is the server of facebook. Which timestamp should i use to match facebook time?

Thank you.

like image 362
Prajwol Onta Avatar asked Jan 25 '13 06:01

Prajwol Onta


People also ask

What format is date time?

For example, the "d" standard format string indicates that a date and time value is to be displayed using a short date pattern. For the invariant culture, this pattern is "MM/dd/yyyy". For the fr-FR culture, it is "dd/MM/yyyy". For the ja-JP culture, it is "yyyy/MM/dd".

What is Microsoft date format?

Overview of date and time formats The dates appear as, mm/dd/yyyy in the U.S. and as, dd/mm/yyyy outside the U.S. where mm is the month, dd is the day, and yyyy is the year. The time is displayed as, hh:mm:ss AM/PM, where hh is the hour, mm is minutes, and ss is seconds.


1 Answers

The date format is called ISO 8601. The letter T is used to separate date and time unambiguously and +0000 is used to signify the timezone offset, in this case GMT or UTC.

That said, you generally don't need to worry so much about the actual contents; rather you should know how to work with them. To use such a date, you can use strtotime() to convert it into a time-stamp:

$ts = strtotime('2013-01-25T00:11:02+0000');

To convert the time-stamp back into a string representation, you can simply use gmdate() with the predefined date constant DATE_ISO8601:

echo gmdate(DATE_ISO8601, $ts);

Alternatively, using DateTime:

// import date
$d = DateTime::createFromFormat(DateTime::ISO8601, '2013-01-25T00:11:02+0000');

// export date
echo $dd->format(DateTime::ISO8601), PHP_EOL;
like image 181
Ja͢ck Avatar answered Sep 18 '22 20:09

Ja͢ck