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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 8.5 time formual

Status
Not open for further replies.

lorri

Technical User
Oct 4, 2006
61
US
Hi - I have a field that is unix time (View_Request.open.date). The field is a number and I have converted to a date/time by the formula
dateadd("s",{View_Request.open_date}-14400,#01/01/1970#)
what I need to do is run a report by time range, for example all Incidents opened between 5pm and 7am for the past 90 days......for that type of range. My question is how do I isolate the time and the date as 2 fields to do this?

help is greatly apprecaited.......Lorri
 
Let's say your datetime formula is called {@datetimex}. You could use a record selection formula like:

{@datetimex} > currentdate - 90 and
(
time({@datetimex}) in time(0,0,0) to time(6,59,59) or
time({@datetimex}) in time(17,0,0) to time(23,59,59)
)

-LB
 
I am just getting a true/false value when I use that
 
Yes, this is a record selection formula to be entered in report->selection formula->record.

-LB
 
is there a way to get this as a prompt though? I need one for date range and then a hard code for the time range - you know what I mean?
 
Set up a {?Daterange} parameter with "allow range values" set to true. Then change the record selection formula to:

{@datetimex} in {?daterange} and
(
time({@datetimex}) in time(0,0,0) to time(6,59,59) or
time({@datetimex}) in time(17,0,0) to time(23,59,59)
)

-LB
 
I gotcha now..........Thanks SO much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top