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

Check for weekends V8.5

Status
Not open for further replies.

tomk01

ISP
Oct 18, 2004
69
US
Is there a way to display a date (friday) if the date falls on a weekend (Saturday)?

I have a dateTime field. If the date falles on a saturday i need the report to display the friday prior.

here is the formula I created that does not work:

Code:
stringvar checkdate := if {SCalendar.checkDate} = crsaturday then Checkdate = "Saturday Checkdate";
 
Since you did not specify how you wanted to display the date, I assumed DD/MM/YYYY

Code:
if DayofWeek({table.date}) = 7 then
   cstr(dateadd("d",-1,{table.date}),"MM/dd/yyyy")
else
   cstr({table.date},"MM/dd/yyyy")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top