Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Return Weekdays only Date Post Reply Post New Topic
Author Message
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Topic: Return Weekdays only Date
     Posted: 28 Oct 2011 at 10:31am

Here is my formual: to add month

if {RMDETL.RDRDUR} = 'M' and year (NumberToDate ({RMDETL.RDDATI})) = -2 then
Dateadd('M', {RMDETL.RDQTY},{@Date Out})
 
Rental Period: 2 Months
Rental Date: 09/26/2011
Return Date: 11/26/2011 (should be 11/25/2011)
 
I need it to calc business day only, if date falls on Saturday it should return Friday's date, Sunday should return Monday's date.
 
Thanks!
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Oct 2011 at 10:43am
You could combine the dayofweek function with the dateadd function to achieve this. So:

if dayofweek({table.datefield})=7
     then dateadd('d', -1, {table.datefield})
          else
if dayofweek({table.datefield})=1
     then dateadd('d', +1, {table.datefield})
          else
{table.datefield}
|< /\ '][' ( )
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum