Stack Exchange API中的日期格式 [英] Date format in the Stack Exchange API
问题描述
当我查询Stack Overflow(使用它的API)以获取一些数据(问题/答案/等)时,我得到以下JSON响应:
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,
last_activity_date
是一个10位数字,对应于1970年的某个日期.当我测试今天的时间戳(在Java中,如果重要的话)时,我得到了一个13位数字.
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.
我得到的回复中日期时间戳的格式是什么?如何将其转换为常规的Unix时间戳?
What is the format of the date timestamps in the responses I get? How do I translate it to regular Unix timestamp?
谢谢.
推荐答案
它采用"d M Y h:i"
格式.因此,如果您使用的是php,则可以执行以下操作:
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);
这篇关于Stack Exchange API中的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!