<?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 SQL Select &amp; Epoch time questions... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613689#M683114</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a database that I am using an ODBC connection to connect to.&amp;nbsp; I can connect to it and pull data.&amp;nbsp; Now i am doing some data modeling and trying to reduce the amount of data and runtime via applying a where clause on a date field.&amp;nbsp; The date field is in epoch time.&amp;nbsp; I would like to set a variable to convert the epoch time to regular time in the script so if I have to use it again, I can simply refer to the variable name.&amp;nbsp; I have the script below, but it returns 'Not a valid month', ORA-01843 .&amp;nbsp; I have tried several variations such as&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013'&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013 12:00:00'&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013 12:00:00 AM'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No dice.&amp;nbsp; Could someone help me out with syntax here?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ODBC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;(connection string)&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;set&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;SubmitDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = (to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + ((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"SUBMIT_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;- 4*3600)/(60*60*24)));&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;SQL&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; SELECT "ASSIGNED_GROUP",&lt;BR /&gt;ASSIGNEE,&lt;BR /&gt;"FULL_NAME",&lt;BR /&gt;"INCIDENT_NUMBER",&lt;BR /&gt;STATUS,&lt;BR /&gt;"SUBMIT_DATE",&lt;BR /&gt;(to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + (("SUBMIT_DATE"- 4*3600)/(60*60*24))) as SubmitDateTime&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;FROM ITSMTST."HPD_HELP_DESK_CLASSIC"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;where $(SubmitDate) &amp;gt; '1/1/2013';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Feb 2014 16:04:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-02-20T16:04:12Z</dc:date>
    <item>
      <title>SQL Select &amp; Epoch time questions...</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613689#M683114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a database that I am using an ODBC connection to connect to.&amp;nbsp; I can connect to it and pull data.&amp;nbsp; Now i am doing some data modeling and trying to reduce the amount of data and runtime via applying a where clause on a date field.&amp;nbsp; The date field is in epoch time.&amp;nbsp; I would like to set a variable to convert the epoch time to regular time in the script so if I have to use it again, I can simply refer to the variable name.&amp;nbsp; I have the script below, but it returns 'Not a valid month', ORA-01843 .&amp;nbsp; I have tried several variations such as&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013'&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013 12:00:00'&lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; '01/01/2013 12:00:00 AM'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No dice.&amp;nbsp; Could someone help me out with syntax here?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ODBC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;(connection string)&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;set&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;SubmitDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = (to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + ((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"SUBMIT_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;- 4*3600)/(60*60*24)));&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;SQL&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; SELECT "ASSIGNED_GROUP",&lt;BR /&gt;ASSIGNEE,&lt;BR /&gt;"FULL_NAME",&lt;BR /&gt;"INCIDENT_NUMBER",&lt;BR /&gt;STATUS,&lt;BR /&gt;"SUBMIT_DATE",&lt;BR /&gt;(to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + (("SUBMIT_DATE"- 4*3600)/(60*60*24))) as SubmitDateTime&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;FROM ITSMTST."HPD_HELP_DESK_CLASSIC"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;where $(SubmitDate) &amp;gt; '1/1/2013';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 16:04:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613689#M683114</guid>
      <dc:creator />
      <dc:date>2014-02-20T16:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select &amp; Epoch time questions...</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613690#M683115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have your table, but this for me works&lt;/P&gt;&lt;P&gt;In submit_date column I have a constant 915148798, just to try your script&lt;/P&gt;&lt;P&gt;Hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set SubmitDate = (to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + ((submit_date - 4*3600)/(60*60*24)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL &lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;$(SubmitDate),&lt;/P&gt;&lt;P&gt;to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS')&amp;nbsp; &lt;/P&gt;&lt;P&gt;from dwh_dl.a&lt;/P&gt;&lt;P&gt;where &lt;/P&gt;&lt;P&gt;$(SubmitDate) &amp;gt; to_date('01/01/1950', 'MM/DD/YYYY')&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:24:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613690#M683115</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-02-20T17:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select &amp; Epoch time questions...</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613691#M683117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It´s a very commom problem while using ORACLE.&lt;/P&gt;&lt;P&gt;It´s a conversion problem&lt;/P&gt;&lt;P&gt;Oracle expects a date into YYYY-MM-DD format OR you tranform your string using TO_DATE function&lt;/P&gt;&lt;P&gt;I would to &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 8pt; font-family: inherit; color: #0000ff;"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt; SELECT "ASSIGNED_GROUP",&lt;BR /&gt;ASSIGNEE,&lt;BR /&gt;"FULL_NAME",&lt;BR /&gt;"INCIDENT_NUMBER",&lt;BR /&gt;STATUS,&lt;BR /&gt;"SUBMIT_DATE",&lt;BR /&gt;(to_date('01/01/1970 00:00:00', 'MM/DD/YYYY HH24:MI:SS') + (("SUBMIT_DATE"- 4*3600)/(60*60*24))) as SubmitDateTime&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;FROM ITSMTST."HPD_HELP_DESK_CLASSIC"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;&lt;STRONG&gt;where $(SubmitDate) &amp;gt; '2013-01-01';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:55:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Select-Epoch-time-questions/m-p/613691#M683117</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2014-02-20T17:55:45Z</dc:date>
    </item>
  </channel>
</rss>

