Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Last Day of Previous Month 1

Status
Not open for further replies.

spiff2002

IS-IT--Management
Jan 31, 2003
40
I'm working on MS-SQL 2000 and I'm trying to calculate the last day of the previous month, i.e.:
Today's date is 12/10/2003 after running the query using today's day as parameter I will get

11/30/2003

Is there a MS-SQL 2000 functions that can do this or has to be calculated with a whole bunch of case statements??
 
This should get you what you want:
Code:
select DateAdd(d,-Day(getdate()),getdate())

~Brian
 
Has anyone had any luck using the end of month function in an access query. I tried:

eomonth(date(),-1)

I'm getting an undefined function.

Any help would be great.

Thanks!
 
Have you tried this ?
DateSerial(Year(Date()),1+Month(Date()),0)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top