Date range for this year and last

J

John

Hi

How can I generate the first and last dates for this year and the last year?
ie if year is 2008 then I need 01/01/2008-31/12/2008 and
01/10/2007-31/12/2007.

Thanks

Regards
 
R

Rick Brandt

Hi

How can I generate the first and last dates for this year and the last
year? ie if year is 2008 then I need 01/01/2008-31/12/2008 and
01/10/2007-31/12/2007.

LastYearStart = DateSerial(Year(Date())-1,1,1)
LastYearEnd = DateSerial(Year(Date())-1, 12,31)
ThisYearStart = DateSerial(Year(Date()),1,1)
ThisYearEnd = DateSerial(Year(Date()),12,31)
 
J

John W. Vinson

Hi

How can I generate the first and last dates for this year and the last year?
ie if year is 2008 then I need 01/01/2008-31/12/2008 and
01/10/2007-31/12/2007.

Thanks

Regards

BETWEEN DateSerial(Year(Date()) - 1, 1, 1) AND DateSerial(Year(Date()) + 1,
12, 31)

or - a bit better if your datefield might contain times -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top