Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 06 Mar 2009 @ 16:09:20 GMT

  <Prev Next>  
Next> Last>>  

Subj:   Which part of the year
From:   Anomy Anom

<-- Anonymously Posted: Fri, 6 Mar 2009 16:57 -->

Hi All

I'm struggling (once more) with date and time functions in Teradata:

This time I'd like to know which part of the year is already over. The following query:

     select (date-cast(extract(year from date) || '-01-01' as date)) / 365.00000

works fine, but it's not so easy to understand and it's not correct for leap years (divison by 366)

Browsing the Teradata-Forum I found this code:

     sel  date (format 'ddd')(char(3));

which would be perfect for my task, unfortunately it's not possible to calculate with it (divison by 365 is not possible).

Thanks for your help.

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020