<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic DateTime to Num rounding error in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/DateTime-to-Num-rounding-error/m-p/1836713#M15583</link>
    <description>&lt;P&gt;In JS I am taking in strings like "2020-09-16 08:26:02" and converting them to numbers like "44090.35141203704"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the function below and on about 25% of my attempts I am getting a rounding error. Has anyone encountered this or done something like this in a mashup/viz before?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let item = "2020-09-16 08:26:02" 
let parts = item.split(/[?:,| -]+/) 
let date = new Date(parts[0], parts[1]-1, parts[2], parts[3], parts[4], parts[5])
let returnDateTime = 25569.0 + (date.getTime() - date.getTimezoneOffset() * 60 * 1000) / (1000 * 60 * 60 * 24);
return returnDateTime;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Sep 2021 14:14:01 GMT</pubDate>
    <dc:creator>danelooman</dc:creator>
    <dc:date>2021-09-16T14:14:01Z</dc:date>
    <item>
      <title>DateTime to Num rounding error</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/DateTime-to-Num-rounding-error/m-p/1836713#M15583</link>
      <description>&lt;P&gt;In JS I am taking in strings like "2020-09-16 08:26:02" and converting them to numbers like "44090.35141203704"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the function below and on about 25% of my attempts I am getting a rounding error. Has anyone encountered this or done something like this in a mashup/viz before?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let item = "2020-09-16 08:26:02" 
let parts = item.split(/[?:,| -]+/) 
let date = new Date(parts[0], parts[1]-1, parts[2], parts[3], parts[4], parts[5])
let returnDateTime = 25569.0 + (date.getTime() - date.getTimezoneOffset() * 60 * 1000) / (1000 * 60 * 60 * 24);
return returnDateTime;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 14:14:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/DateTime-to-Num-rounding-error/m-p/1836713#M15583</guid>
      <dc:creator>danelooman</dc:creator>
      <dc:date>2021-09-16T14:14:01Z</dc:date>
    </item>
  </channel>
</rss>

