windows - 将 Unix/Linux 时间转换为 Windows 时间的方法

标签 windows linux ms-office datetime

我想要很多方法在两个系统上的两者之间进行转换。我正在寻找一种快速简便的方法来做到这一点。

我想要 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/

相关文章:

php - 在 linux 上将 php 模块与 .so 库链接

c - 需要在 shell 脚本中获取 C 程序名称

linux - Bash 脚本会提供有关所需目录的信息

excel - VBA最终用户将Microsoft Office 2007升级到2010(从VBA 6到VBA7)的问题以及对文档,帮助和提示的需求。 (足够使用关键字)

c++ - 从 Microsoft Word 获取所有宏(使用自动化)

ios - OneDrive IOS SDK,错误 : Sorry, 但我们无法登录,这是错误的请求

mysql - 如何在 Windows 上备份 MySQL 数据库?

windows - "gem install"卡住在 "updating Gem source index for [..]"

python - 错误: Could not find a version that satisfies the requirement azure-functions

java - 如何提供关闭 Internet Explorer 窗口的确认?