Print Page | Close Window

date range Friday noon to Sunday noon

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15139
Printed Date: 03 May 2025 at 2:27pm


Topic: date range Friday noon to Sunday noon
Posted By: jimbo33
Subject: date range Friday noon to Sunday noon
Date Posted: 12 Dec 2011 at 8:07am
Hi All -  I am trying to create a date range from every Friday noon to Sunday noon that checks vehicle mileage for that period.   The report would be run on Sunday afternoon.  I can't seem to get this to work. 
 
For the Friday start date :
 
if {CALENDAR_DAYS.CAL_DOW_NUM} = 6   then
DateAdd("H", 12, {CALENDAR_DAYS.CAL_DATE})
 
and for the Sunday date:
 
if {CALENDAR_DAYS.CAL_DOW_NUM} = 1 then
DateAdd("h", 12, {CALENDAR_DAYS.CAL_DATE})
 
I then set the record selection to:
 
{METER_JNL.METER_DATE} in DateTime (CDate( mailto:%7b@startdate - {@startdate })) to DateTime (CDate( mailto:%7b@Sunday - {@Sunday }))
 
Any suggestions would be greatly appreciated.  Thanks.


-------------
jimbo33



Replies:
Posted By: comatt1
Date Posted: 13 Dec 2011 at 6:33am

I woudl just calculate the sunday value

if {CALENDAR_DAYS.CAL_DOW_NUM} = 1 then
DateAdd("h", 12, {CALENDAR_DAYS.CAL_DATE})
 
try outputting the formula to see what gets pulled.
 
then for your select; not able to test, but try
 
{METER_JNL.METER_DATE} in dateadd('h', -48,DateTime (CDate( mailto:%7b@sunday - {@sunday }))) to DateTime (CDate( mailto:%7b@sunday - {@sunday }))


Posted By: jimbo33
Date Posted: 13 Dec 2011 at 7:56am
That works !!! Thank you!

-------------
jimbo33



Print Page | Close Window