Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
将日期和时间格式转换为秒的 C# 代码。例如:2013-04-03 01:00:00 到 1364950800
您似乎正在寻找 Unix 文件时间(即自 1970 年 1 月 1 日起):
var unixFileTimeOrigin = DateTime.Parse("1970-01-01"); var date = DateTime.Parse("2013-04-03 01:00:00"); Console.WriteLine((date - unixFileTimeOrigin).TotalSeconds); >>> 1364950800