All Forums General
A212741 7 posts Joined 05/15
24 Jun 2015
Get the number of days in a month

Hi
Please assist I need to get the number of days in a month to do a calculation eg. 31, 28, 30 ect, in SQL i would do someting like this, but I'm stuck in Teradata.
select DAY(DATEADD(mm, DATEDIFF(mm, -1, GETDATE()), -1))
 
 
 

Glass 225 posts Joined 04/10
24 Jun 2015

One Way:
 

sel month_of_year, max(day_of_month) from sys_calendar.calendar where year_of_calendar = 2015 group by 1 order by 1;
 
Rglass

A212741 7 posts Joined 05/15
25 Jun 2015

thanks Glass it worked perfectly !
Rgds
Jx

dnoeth 4628 posts Joined 11/04
25 Jun 2015

TD14: 

SELECT  EXTRACT(DAY FROM LAST_DAY(CURRENT_DATE))

 

Dieter

You must sign in to leave a comment.