<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"></p>
<div>Hi, <br>
<br>
Just noticed the inconsistent of <span>date calculation of hours since "0001-01-01 00:00"</span><span>,  
<span>there are 2 days difference between NCL and other script/command, such as date, php.
</span><br>
<br>
Saying <span><span>"17682542 hours since 0001-01-01 00:00"</span></span>,  NCL gave
<span><span><span>2018</span>-03-18 14:00</span></span>,  Linux date command and php script gave
<span><span><span><span>2018</span>-03-20 14:00</span></span></span>. </span><span>  Wondering who is correct.
<br>
<br>
Here are the output of NCL<br>
</span>
<blockquote><span>
<div>ncl 1> print (f->time) </div>
</span></blockquote>
<blockquote><span>
<div>Variable: time (file variable)</div>
</span><span>
<div>Type: double</div>
</span><span>
<div>Total Size: 8 bytes</div>
</span><span>
<div>            1 values</div>
</span><span>
<div>Number of Dimensions: 1</div>
</span><span>
<div>Dimensions and sizes:   [time | 1]</div>
</span><span>
<div>Coordinates:</div>
</span><span>
<div>            time: [17682542..17682542]</div>
</span><span>
<div>Number Of Attributes: 2</div>
</span><span>
<div>  units :       hours since 0001-01-01 00:00:00.0</div>
</span><span>
<div>  calendar :    standard</div>
</span><span>
<div>(0)     17682542</div>
</span><br>
<span>
<div>ncl 2> utc_date=cd_calendar(f->time,0)</div>
</span><span>
<div>ncl 3> print(utc_date)</div>
</span><span>
<div>Variable: utc_date</div>
</span><span>
<div>Type: float</div>
</span><span>
<div>Total Size: 24 bytes</div>
</span><span>
<div>            6 values</div>
</span><span>
<div>Number of Dimensions: 2</div>
</span><span>
<div>Dimensions and sizes:   [1] x [6]</div>
</span><span>
<div>Coordinates:</div>
</span><span>
<div>Number Of Attributes: 1</div>
</span><span>
<div>  calendar :    standard</div>
</span><span>
<div>(0,0)   2018</div>
</span><span>
<div>(0,1)    3</div>
</span><span>
<div>(0,2)   18</div>
</span><span>
<div>(0,3)   14</div>
</span><span>
<div>(0,4)    0</div>
</span><span>
<div>(0,5)   1.341105e-05</div>
</span></blockquote>
<span><span>Here are the output of date command</span><br>
<br>
    date -d "<span><span><span>17682542 hours 0001-01-01 00:00"</span></span></span> +"%Y-%m-%d %H:%M"<br>
<br>
<span><span>2018</span>-03-20 14:00</span><br>
<br>
<span><span>Here are the output of</span></span> PHP<br>
<br>
    ini_set('date.timezone', 'UTC');<br>
    $t=strtotime('0001-01-01  +<span><span><span>17682542 hours</span></span></span>) ;<br>
<span></span></span><span></span>    echo date('Y-m-d H:i', $t);<br>
<br>
2018-03-20 14:00<br>
<br>
Thanks for your time <br>
<br>
Regards<br>
<br>
Jerry<br>
<br>
<br>
</div>
<p></p>
</div>
</body>
</html>