我想要很多方法在两个系统上的两者之间进行转换。我正在寻找一种快速简便的方法来做到这一点。
我想要 Python 方式、excel、openoffice calc 方式、访问方式、命令行方式。你做的任何其他方式也会很好。换一种方式(从 Windows 到 Linux)也不错
我的一些脚本的输出包括自 1970 年以来的秒数,但我想转换为 Windows 时间。这样当它被导入数据库时就不会弄乱时间。
In Linux you can obtain time in microseconds (10^-6 sec) from 1 Jan 1970 using gettimeofday.
In Windows Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
这是一种 C 方式。 Convert Unix/Linux time to Windows FILETIME
从查找中输出的例子
find ./sd-mmc-card/ -iname *.jpg -printf "%h/%f\t%f\t%a\t%Ax\t%AT\t%A@\n" > dbtime.txt
./sd-mmc-card/0117.jpg 0117.jpg Thu Mar 24 15:27:25.0059226867 2011 24/03/2011 15:27:25.0592268670 1300973245.0592268670
最佳答案
这在 Converting a time_t Value to a File Time 中有描述,它提供了示例 C 代码。
总结:
filetime = (unixtime * 10000000) + 116444736000000000
0x3DE43B0C → 0x01C295C4:91150E00 (2002-11-27 03:25:00 +0000)
(How to recognize different types of timestamps from quite a long way away 也很有帮助。)
通常使用 strptime( )
或类似的。
关于windows - 将 Unix/Linux 时间转换为 Windows 时间的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5471379/