擅长:python、mysql、java
<p><strong>编辑</strong>:OP添加了详细信息,指定时间从<em>午夜</em>开始,因此它是<em>绝对</em>时间,不同于从<em>中午</em>开始的J2000。但既然标题上写着“时间戳从2000年1月1日开始”,我就让这个答案留给未来的答案寻求者。</p>
<p><strong>回答:</strong></p>
<p>您提到的时间戳似乎是提到的J2000.0 <a href="https://en.wikipedia.org/wiki/Epoch_(reference_date)#J2000.0" rel="nofollow">here</a></p>
<p>因为Unix和J2000纪元时间是常量,所以可以定义一个常量来存储差异。</p>
<p>如果你有数学倾向,下面的链接提供一些关于转换的信息</p>
<ol>
<li><a href="http://www.giss.nasa.gov/tools/mars24/help/algorithm.html" rel="nofollow">http://www.giss.nasa.gov/tools/mars24/help/algorithm.html</a>参考步骤A-2</li>
<li><p><a href="http://onegeek.org/software/smeg/current/src/time.c" rel="nofollow">http://onegeek.org/software/smeg/current/src/time.c</a>(C文件)</p>
<p>C文件中的<code>#define</code>部分包含以下内容</p>
<p><code>#define J2000 2451545.0 /* you-know-when */</code></p>
<p><code>#define U1970 -10957.5 /* unix epoch relative to J2000 */</code></p></li>
</ol>