<?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 Is timestamp difference always INTERVAL DAY TO SECOND? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13623#M8262</link>
    <description>&lt;P&gt;My observations show that timestamp difference has type of&amp;nbsp;INTERVAL DAY TO SECONDS:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select typeof(getdate() - current_date())
-----------------------------------------
interval day to second&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But is it guaranteed? Can it be&amp;nbsp;DAY TO MINUTE&amp;nbsp;or, say, YEAR TO MONTH&amp;nbsp;depending on the input? I could not find that in the documentation.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 01:37:03 GMT</pubDate>
    <dc:creator>vr</dc:creator>
    <dc:date>2023-01-05T01:37:03Z</dc:date>
    <item>
      <title>Is timestamp difference always INTERVAL DAY TO SECOND?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13623#M8262</link>
      <description>&lt;P&gt;My observations show that timestamp difference has type of&amp;nbsp;INTERVAL DAY TO SECONDS:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select typeof(getdate() - current_date())
-----------------------------------------
interval day to second&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But is it guaranteed? Can it be&amp;nbsp;DAY TO MINUTE&amp;nbsp;or, say, YEAR TO MONTH&amp;nbsp;depending on the input? I could not find that in the documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 01:37:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13623#M8262</guid>
      <dc:creator>vr</dc:creator>
      <dc:date>2023-01-05T01:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is timestamp difference always INTERVAL DAY TO SECOND?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13624#M8263</link>
      <description>&lt;P&gt;It will be like that if you manipulate seconds. As getdate() includes seconds, it will be that object, but if you make select typeof(getdate() + INTERVAL 1 DAY), it will be a timestamp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe having seconds as integer guaranteed from midnight will be the best:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select CAST(current_timestamp() AS INT) - CAST(timestamp(current_date()) AS INT)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 09:26:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13624#M8263</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-01-05T09:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is timestamp difference always INTERVAL DAY TO SECOND?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13625#M8264</link>
      <description>&lt;P&gt;Some hints for you&lt;/P&gt;&lt;P&gt;TIMESTAMP supports fractional seconds, unlike DATE which supports only seconds&lt;/P&gt;&lt;P&gt;TIMESTAMP exist in three flavors:&lt;/P&gt;&lt;P&gt;TIMESTAMP does not contain any time zone information.&lt;/P&gt;&lt;P&gt;TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE contain time zone information&lt;/P&gt;&lt;P&gt;Regarding calculation and manipulation there is actually no difference between TIMESTAMP and DATE. There are only a very few functions which support only either of these two types.&lt;/P&gt;&lt;P&gt;DATE is an old data type. TIMESTAMP was introduced later (well "later" means in 9i, i.e. 20 years ago) INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND are interval data types, they do not contain any absolute date information.&lt;/P&gt;&lt;P&gt;Hope this gave some hints.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 12:25:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13625#M8264</guid>
      <dc:creator>AdrianLobacz</dc:creator>
      <dc:date>2023-01-05T12:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is timestamp difference always INTERVAL DAY TO SECOND?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13626#M8265</link>
      <description>&lt;P&gt;you can check here for given example: &lt;A href="https://docs.databricks.com/sql/language-manual/functions/minussign.html" target="test_blank"&gt;https://docs.databricks.com/sql/language-manual/functions/minussign.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this might help to you.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 06:20:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-timestamp-difference-always-interval-day-to-second/m-p/13626#M8265</guid>
      <dc:creator>sher</dc:creator>
      <dc:date>2023-01-06T06:20:02Z</dc:date>
    </item>
  </channel>
</rss>

