开发者

Date format in the Stack Exchange API

When I query Stack Overflow (using it's API) to get some data (questions/answers/etc) I get the following JSON response:

"down_vote_count": 0, 
  "last_activity_date": 1300830790, 
  "creation_date": 1300829790, 

The last_activity_date is a 10 digit number corresponding to some date in 1970. when I test today's timestamp (in Java if it's important) I get a 13 digit number.

What is the format of the date ti开发者_StackOverflow社区mestamps in the responses I get? How do I translate it to regular Unix timestamp?

Thanks.


it is in the "d M Y h:i" format. so if you're using php you can do :

function sanitizeDate($date){
  return date('d M Y h:i', $date);
}

//and call it like
$testdate = 1344855907;
echo sanitizeDate($testdate);


I know it is an old post but the "last_activity_date": 1300830790 is actually a Unix timestamp, and it translates to Tuesday, March 22, 2011 9:53:10 PM This site https://www.epochconverter.com/ has a quick converter and some code to do the translation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜