计算机时间戳转换时间在线,将Epoch时间戳转换为日期格式(Convert Epoch timestamp to date format)...

Since you have 10-digit numbers as the created time, you're probably using 'Unix timestamps', which count seconds since The Epoch, which is 1970-01-01 00:00:00 +00:00 (midnight on the morning of 1st January 1970 in the UTC or GMT time zone). If you had 13-digit numbers, it would probably be milliseconds since The Epoch, used in Java. There are other systems, but this is a plausible guess.

There are lots of systems of functions that will convert such values into dates. I have a C program using standard library functions that I used to validate your date:

$ timestamp 1421434541

1421434541 = Fri Jan 16 10:55:41 2015

$ timestamp -u 1421434541

1421434541 = Fri Jan 16 18:55:41 2015

$ timestamp -T '%Y-%m-%d %H:%M:%S' -u 1421434541

1421434541 = 2015-01-16 18:55:41

$

(Local time zone: US/Pacific, aka America/Los_Angeles.)

The program uses strtol() to convert the number in a string to an long and then uses localtime() or gmtime() to break that into a struct tm, and then uses strftime() to format the result.

The GNU date command can be used to do that stuff too:

$ /usr/gnu/bin/date -d @1421434541 +'%Y-%m-%d %H:%M:%S'

2015-01-16 10:55:41

$

Since you've not identified your host language, it is not really possible to tell you what to use. It is pretty much guaranteed that whatever language you choose, there'll be code available to handle the conversion, though.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值