A script was recently published (Last_Date_Of_Month) that returns the last day of a given month/year combination. I have simplified and improved on that script by eliminating the need to use a WHILE loop. This new script exploits the flexibility of the DATEADD function which allows you to assign negative numbers (thus effectively subtracting a given date element from the entered date). By setting the date format explicitly the script is also guaranteed to work for all locales. There is certainly no performance gain but I think it's a litte more elegant!
2007-10-02 (first published: 2002-06-20)
15,451 reads