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

Time Period Formula 1

Status
Not open for further replies.

jrperry

Technical User
Jun 10, 2002
14
NZ
I need to generate a report based on a particular time period. The time period is from 3:00pm yesterday to 7:59am today.
This report has a datetime field which is used in the selection criteria.
The report has to be automated so setting a specific date value is not possible.
The report engine is Crystal Reports 7.
What is the most efficient way of writing this formula?
I have started to use local variables to determine the date for yesterday and the start time of the report, then use these variables in the selection criteria.
Is this the best method. Are there better methods that can speed up the query?

feedback appreciated.
 
create two formulas

@before 8:
datevar before8:=currentdate;
datetime(year(before8),month(before8),day(before8),7,59,59)


@after 3
datevar yesterday:=today-1;
datetime(year(yesterday),month(yesterday),day(yesterday),15,0,0)


Then for your select expert use:
{your.datetime.field} in {@after 3} to {@before 8} Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top