www.kingmaxyang.cn

不能不说的秘密

使用PHP将.Net格式的时间戳转换成可读时间格式

代码如下:

[code lang="php"]

function get_date($net_timestamp){ //输入.Net时间戳值
$S = 60*60*24;
return date("Y-m-d H:i:s",$S*($net_timestamp-25569.333333));
//返回真实的可读时间格式
}

[/code]

今天在网上找了很久,没有找到,干脆自己按照原理上来写一个,发现就是这么简单。那个25569.333333可能会受到个别时区不同调整一下,但思路不变。

posted by kingmaxyang in Can't Unsay,Tech and have No Comments

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment