<?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 Re: Unix time stamp in where clause in Qlik Learning Discussions</title>
    <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755008#M1407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used unix_timestamp in where clause.&lt;/P&gt;&lt;P&gt;However, the data returned is not limited to those with 'created' after 2015-03-04 21:00:00.&lt;/P&gt;&lt;P&gt;I have some data with 2015-03-03 in the created field.&lt;/P&gt;&lt;P&gt;I think it returns all data from the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also find something funny. The script returns all data from the table when I put created greater than certain timestamp in the where clause. (i.e. WHERE created &amp;gt; unix_timestamp('2015-03-04 21:00:00')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But no data at all return when I put an extra&amp;nbsp; timestamp condition in the where clause like below.&lt;/P&gt;&lt;P&gt;WHERE created &amp;gt; unix_timestamp('2015-03-04 21:00:00')&lt;/P&gt;&lt;P&gt;and created &amp;lt;unix_timestamp('2015-03-05 21:00:00')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2015 03:30:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-03-09T03:30:26Z</dc:date>
    <item>
      <title>Unix time stamp in where clause</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755004#M1403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am loading a sql table with unix_time stamp in it.&lt;/P&gt;&lt;P&gt;I have converted the unix_time by the script below&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;ConvertToLocalTime&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;timestamp&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((25569+(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;created&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;+3600000)/(1000000000*24*3600))), 'GMT+08:00') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;created&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;Now I want to load data which only falls between certain time stamp by defining the time frame in where clause.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;But I don't know how to do it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;I wrote a script like below, but it doesn't work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;How should I define the right time in the where clause for fields which are converted unixtime?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;Load &amp;lt;field A&amp;gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field B&amp;gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConvertToLocalTime&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;timestamp&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((25569+(&amp;lt;myunix_time field&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;+3600000)/(1000000000*24*3600))), 'GMT+08:00') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;created;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;SQL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;From &amp;lt;mysqltable&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Where created &amp;gt;'4/03/2015 21:00:00';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 07:25:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755004#M1403</guid>
      <dc:creator />
      <dc:date>2015-03-06T07:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unix time stamp in where clause</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755005#M1404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your sql source contains a 'created' field then you can use a where clause with the created field. If your sql source table does not contain a 'created' field then you can't do that, but you will need to use the original unix timestamps from the 'myunix_time' field. What kind of function you need to convert the unix timestamp to a date depends on what database system you're using. SQL Server, Oracle, MySql etc all have different functions for dealing with unix timestamps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 09:14:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755005#M1404</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-03-06T09:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unix time stamp in where clause</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755006#M1405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Gysbert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using MySQL.&lt;/P&gt;&lt;P&gt;The sql unix_time stamp filed name is 'created', so it is fine to put 'created' in the where clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 09:21:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755006#M1405</guid>
      <dc:creator />
      <dc:date>2015-03-06T09:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unix time stamp in where clause</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755007#M1406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, then if I understand your problem correctly the &lt;A href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_unix-timestamp"&gt;unix_timestamp&lt;/A&gt; function could be used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT * FROM ....&lt;/P&gt;&lt;P&gt;WHERE created &amp;gt; unix_timestamp('2015-03-04 21:00:00')&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 09:27:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755007#M1406</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-03-06T09:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Unix time stamp in where clause</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755008#M1407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used unix_timestamp in where clause.&lt;/P&gt;&lt;P&gt;However, the data returned is not limited to those with 'created' after 2015-03-04 21:00:00.&lt;/P&gt;&lt;P&gt;I have some data with 2015-03-03 in the created field.&lt;/P&gt;&lt;P&gt;I think it returns all data from the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also find something funny. The script returns all data from the table when I put created greater than certain timestamp in the where clause. (i.e. WHERE created &amp;gt; unix_timestamp('2015-03-04 21:00:00')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But no data at all return when I put an extra&amp;nbsp; timestamp condition in the where clause like below.&lt;/P&gt;&lt;P&gt;WHERE created &amp;gt; unix_timestamp('2015-03-04 21:00:00')&lt;/P&gt;&lt;P&gt;and created &amp;lt;unix_timestamp('2015-03-05 21:00:00')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 03:30:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Unix-time-stamp-in-where-clause/m-p/755008#M1407</guid>
      <dc:creator />
      <dc:date>2015-03-09T03:30:26Z</dc:date>
    </item>
  </channel>
</rss>

