Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Is_Leap Function Expand / Collapse
Author
Message
Posted Friday, June 20, 2008 8:37 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, February 18, 2013 1:11 AM
Points: 478, Visits: 128
Comments posted to this topic are about the item Is_Leap Function
Post #520751
Posted Tuesday, August 12, 2008 2:52 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:54 AM
Points: 1,180, Visits: 2,675
Or alternatively this:
select IsLeapYear = case when day(dateadd(day,-1,dateadd(month,2,dateadd(year,@year-1900,0)))) = 29 then 1 else 0 end 

Which basically calculates the day before March 1st.


--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #550807
Posted Wednesday, August 13, 2008 1:25 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, February 18, 2013 1:11 AM
Points: 478, Visits: 128
I Liked it :)
Post #552227
Posted Tuesday, August 19, 2008 3:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, December 3, 2013 12:19 AM
Points: 8, Visits: 36
You could get the same result from something like

isdate(cast(@year as char(4)) + '-02-29')



Post #554823
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse