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!

Changing date to last work day (M - F)

Status
Not open for further replies.

TEM3

Technical User
Dec 6, 2004
324
US
I have a report that displays activities for the current day, the current week to day, month to day and year to day. I am planning to add "previous (work) day". I would like currentdate to convert to a the previous Friday's date if the report is run on a Saturday or Sunday (and also, when I add, currentdate-1 convert if it is a Saturday or Sunday).

What would be a good conversion formula to use to convert currentdate to a workday??
 
Sorry, forgot: Crystal Reports 8.5 and Oracle Tables.
 
Try something like:

if dayofweek(currentdate) in 3 to 7 then
{table.date} = currentdate-1 else
if dayofweek(currentdate) = 1 then
{table.date} = currentdate-2 else
if dayofweek(currentdate) = 2 then
{table.date} = currentdate-3

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top