解析Twitter API日期戳 [英] Parsing Twitter API Datestamp

查看:165
本文介绍了解析Twitter API日期戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用twitter API返回状态更新列表及其创建时间。它将按以下格式返回创建日期:

I'm using the twitter API to return a list of status updates and the times they were created. It's returning the creation date in the following format:


Fri Apr 09 12:53:54 +0000 2010

Fri Apr 09 12:53:54 +0000 2010

最简单的方法(用PHP或Javascript)格式化这个就像09-04-2010一样?

What's the simplest way (with PHP or Javascript) to format this like 09-04-2010?

推荐答案

strtotime(dateString); 将其转换为本机PHP日期格式,然后您可以使用 date()函数可以打印出你喜欢它的方式。

strtotime("dateString"); gets it into the native PHP date format, then you can work with the date() function to get it printed out how you'd like it.

这篇关于解析Twitter API日期戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆