Oct 27, 2000 #1 PT5SS Programmer Oct 6, 2000 5 US I used to use a function called LAST_DAY in PL/SQL. The function would return the last day of a month based on a given year. Is there a similar function available in SQL 7.0
I used to use a function called LAST_DAY in PL/SQL. The function would return the last day of a month based on a given year. Is there a similar function available in SQL 7.0
Oct 27, 2000 #2 TomasDill IS-IT--Management Sep 2, 2000 703 UA No, but you may use following: dateadd(dd,-1,dateadd(mm,1,'10/01/2000')) returns 2000-10-31 - last day of the 10-th month. Vlad Grynchyshyn vgryn@softserve.lviv.ua http://www.softserve.lviv.uaThe professional level of programmer could be determined by level of stupidity of his/her bugs Upvote 0 Downvote
No, but you may use following: dateadd(dd,-1,dateadd(mm,1,'10/01/2000')) returns 2000-10-31 - last day of the 10-th month. Vlad Grynchyshyn vgryn@softserve.lviv.ua http://www.softserve.lviv.uaThe professional level of programmer could be determined by level of stupidity of his/her bugs
Oct 27, 2000 Thread starter #3 PT5SS Programmer Oct 6, 2000 5 US Thanks for the help! Upvote 0 Downvote
Oct 30, 2000 #4 TomSark MIS Oct 19, 2000 448 US Hi, Um... that code would return the last day of the 9th month, not the 10th month. I would do this: DECLARE @mydate datetime SET @mydate = '11/01/2000' SELECT DAY(dateadd(dd,-1, @mydate)) to get the last day of a month (of October in this case). Note the lack of the second dateadd call. Tom Upvote 0 Downvote
Hi, Um... that code would return the last day of the 9th month, not the 10th month. I would do this: DECLARE @mydate datetime SET @mydate = '11/01/2000' SELECT DAY(dateadd(dd,-1, @mydate)) to get the last day of a month (of October in this case). Note the lack of the second dateadd call. Tom