Topic: Date and days to exclude weekend
Oldest Post First
Newest Post First
Author
Message
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Topic: Date and days to exclude weekend Posted: 25 May 2016 at 10:10am
Hello,
in my report I have two parameters, @Startdate and @EndDate.
My question is, how do I substract from my @Startdate and @EndDate
and just to get weekdays only? Can Crystal handle this thru the formula?
I can get the total days if I substrack between @Startdate and @EndDate
but I need to get just the weekdays.
For example
if my @Startdate = 05/18/2016 and my @EndDate = 05/25/2016 the the total
days I am expecting to see is: 5 days instead 7 days.
Anyone knows how to write this formula? Edited by CrystalGirl - 25 May 2016 at 10:10am
IP Logged
Valert16
Groupie
Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Posted: 26 May 2016 at 12:30am
You have an example of doing exactly what you ask for.
This a copy & paste from the CR help for the DateDiff function:
"For example, suppose you want to calculate the number of days between the order date and ship date, excluding Saturdays and Sundays: "
Local DateTimeVar d1 := {Orders.Order Date};
Local DateTimeVar d2 := {Orders.Ship Date};
DateDiff ("d", d1, d2) - DateDiff ("ww", d1, d2, crSaturday) - DateDiff ("ww", d1, d2, crSunday)
IP Logged
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Posted: 26 May 2016 at 3:27am
Valert16,
That's really cool! I am new in Crystal Reports. You are good!
IP Logged
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Posted: 28 Jun 2016 at 1:25pm
Valert16,
Do you know how to update the above working formula if I want to add to exclude the Holiday as well?
Thanks Valert16 Edited by CrystalGirl - 28 Jun 2016 at 1:35pm
IP Logged
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
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
This page was generated in 0.047 seconds.