What is equivalent of DateTime.ToOADate() in javascript?

后端 未结 7 1646
误落风尘
误落风尘 2020-12-06 21:30

How can I get the OADate (OLE Automation date) in javascript? I need to pass my date object (to my web service) in the form of a double value.

in c#:



        
7条回答
  •  猫巷女王i
    2020-12-06 22:08

    Those look good for JS above, but if you want to do convert it into a Unix timestamp in PHP, use the following:

    // $ms_date_floating_point is the MS date
    // 42372.3432210648 converts to Sun Jan 3rd, 2016
    $ms_date_seconds = $ms_date_floating_point * 60 * 60 * 24;
    $unix_timestamp_seconds = strtotime("Nov 11, 1899 00:00:00") + $ms_date_seconds;
    

提交回复
热议问题