简体   繁体   English

这是什么时间戳格式

[英]what timestamp format is this

I have a timestamp exported from a program that I'm not sure how to convert programmatically using c# 我从一个程序导出的时间戳不知道如何使用c#进行编程转换

I can get more examples if required 如果需要,我可以获取更多示例

any pointers would be appreciated 任何指针将不胜感激

1280833200 == 3 aug 2010 12:00 1280833200 == 2010年8月3日12:00

thanks, 谢谢,

Mark 标记

isnt that the datetime in ticks Unix time ? 心不是在日期时间 Unix时间

edit: yes it is: http://www.epochconverter.com/ 编辑:是的,它是: http : //www.epochconverter.com/

You can make a DateTime by adding those seconds to a new date. 您可以通过将这些秒添加到新日期来创建DateTime

DateTime d = new DateTime(1970, 1, 1, 0, 0, 0)).AddSeconds(1280833200)

It's Unix time - the number of seconds since midnight UTC on 1st January 1970. You can use this site to convert the timestamp to an ordinary date and time. 这是Unix时间 -自1970年1月1日UTC午夜以来的秒数。您可以使用此站点将时间戳转换为普通的日期和时间。

As for conversion in C#, this should work: 至于在C#中的转换,这应该可以:

double timestamp = 1280833200;
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
dateTime = dateTime.AddSeconds(timestamp);

This is a Unix timestamp; 这是Unix时间戳; number of seconds since Jan 1, 1970. You can convert like: 自1970年1月1日以来的秒数。您可以像这样转换:

DateTime epoch = new DateTime(1970,1,1);
DateTime ts = epoch.AddSeconds(1280833200);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM