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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Formula

Status
Not open for further replies.

jtr9999

MIS
Jan 25, 2008
27
US
I need a formula that populates the correct date based on the date a report is run. I want to be able to run it on a certain date and have it populate the correct date. I wrote the little segment below and that does what I want it to do, but it will only work for this year. I don't want to have to touch the formula when the year becomes 2009. The months and days will always be the same. Is there a current year function or something else I can use to get it to change the year when it becomes 2009 or 2010?


//if CurrentDate = Date (2008,01,03) then
//'March 31, 2008'
//else if CurrentDate = Date (2008,04,03) then
//'June 30, 2008'
//else if CurrentDate = Date (2008,07,03) then
//'September 30, 2008'
//else if CurrentDate = Date (2008,10,03) then
//'December 31, 2008'
 
if CurrentDate = Date(year(currentdate),01,03) then
'March 31, '+totext(year(currentdate),"0000") else
if CurrentDate = Date(year(currentdate),04,03) then
'June 30, '+ totext(year(currentdate),"0000") else
if CurrentDate = Date(year(currentdate),07,03) then
'September 30, '+totext(year(currentdate),"0000") else
if CurrentDate = Date(year(currentdate),10,03) then
'December 31, '+ totext(year(currentdate),"0000")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top