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!

Time range on specific day of the week

Status
Not open for further replies.

kamiel71

IS-IT--Management
Jun 3, 2009
2
US
I am needing to capture occurrences within a specific time range for the week. The first 2 timevalue statements below work fine.

What is giving me issue is changing the time range for only 1 day(Sun). I am wanting to only capture occurrences on Sun from 7:30am to 11pm but I'm getting stuck.

This is a datetime field; Oracle db using Crystal 11.

TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(23, 00, 00) and
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) > time(07, 30, 00)


Thanks,
Kamie

or

//((TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(19, 00, 00)) (in ({@dayofweek} in [7])))
 
I would think something like this should work: (That's if the Departure_Time is a date/time field.. If not, you can use the related date field.

if DayOfWeek ({PAT_ENC_HSP.ED_DEPARTURE_TIME})= 7 and
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(19,00,00) then "Sunday" else

if TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(23, 00, 00) and
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) > time(07, 30, 00) Then "Not Sunday
 
Thanks!! Your suggestion put me in the right direction! Here was my final solution in case your curious :) -Kamie

((if DayOfWeek ({PAT_ENC_HSP.ED_DEPARTURE_TIME})= [2,3,4,5,6,7] then
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(23, 00, 00) and
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) > time(07, 30, 00))
or
(if DayOfWeek ({PAT_ENC_HSP.ED_DEPARTURE_TIME})= 1 then
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) < time(19, 00, 00) and
TimeValue ({PAT_ENC_HSP.ED_DEPARTURE_TIME}) > time(07, 30, 00)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top