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 IamaSherpa 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.

farrelm2

Technical User
Oct 4, 2002
18
US
I need to set up formulas to output Monday's date of the current week, first day of current month, and first day of current year. For example, if I run my report tomorrow (Tuesday), I need 3 formulas for 3 different outputs. The outputs are: one that reads October 7,2002,(Monday of this week) one that reads October 1, 2002, (first day of the month) and one that reads January 1, 2002 (first day of the year).

Any suggestions?
 
Create three formulas:

For the Monday:
minimum(weektodatefromsun)+1

1st of the month:
currentdate-(day(currentdate)-1)

1st of the year:
date(year(currentdate),1,1)

Now right click these formulas and select format field->Date/Time. You can either select from the list, or select customize and adjust the way the dates are formatted.

-k kai@informeddatadecisions.com
 
{df}=your date field

Monday:
date(dateadd("d",2- dayofweek({df}),{df}))

Month:
date(year({df}),month({df}),1)

year:
date(year({df}),1,1) Mike

 
Thanks synapsevampire! Works perfectly!
 
I didn't read your post correctly. My formulas would work based on a field in your report, not the date the report is run. For that, replace the {df} with currentdate. Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top