Anh_Tran Posted October 11, 2002 Posted October 11, 2002 IS there a function to recognise that given date is the last day of the month ... Thanks
LiveOak Posted October 11, 2002 Posted October 11, 2002 I don't know what information you are starting with (current month? current date?), so I can't give you an exact forumla. The principle is to take the first day of the next month and subtract one from the date (11/1/2002 - 1 = 10/31/2002). The advantage of this approach is you automatically take leap years into account. -bd
CobaltSky Posted October 11, 2002 Posted October 11, 2002 No there is no one function that will do it, but you could get there with a formula combining the Case( ) and Month( ) functions, along the lines of: Case(Month(GivenDate + 1) <> Month(GivenDate), "**Last Day of Month**")
Anh_Tran Posted October 11, 2002 Author Posted October 11, 2002 I mean it is a given date ...how do we know it is the last day of that given date Example: any given date: 2002-8-30 ...not the last day of that month of that given date (2002-8-30) but 2002-8-31 ...it is the last day of that month of the date 2002-8-31 The way u said is good ...can we also calcualte next month? moth(givandate) +1 ...is that correct? Thanks
Anh_Tran Posted October 11, 2002 Author Posted October 11, 2002 Dear Cobaltsky, You are so intelligent ..thanks
CobaltSky Posted October 11, 2002 Posted October 11, 2002 The formula I suggested should work for any date which is supplied as 'GivenDate'. As regards your second question about calculating the next month, there is a problem with your suggestion, Month(GivenDate) + 1 in that if GivenDate is in December, it will return 13. However Month(Month(GivenDate) + 1) will work for all cases.
Recommended Posts
This topic is 8149 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now