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!

CR Date and time formula help 1

Status
Not open for further replies.

brecat77

IS-IT--Management
Feb 27, 2008
28
US
I need to figure a formula to give me currentdate from 6am to currentdate-1 6am. any help is appreciated
 

dateadd("h",-18,datetime(currentdate)) -- Yesterday 6 am

dateadd("h",6,datetime(currentdate)) -- Today 6 am
 
so to put the dates within a range to go from

6am to 6am how would that formula show? I'm still having trouble with it.

This is my current formula

{TRANS.TypeDescription} = "ISSUE" and
{TRANS.Transdate} = dateadd("h",6,datetime(currentdate)) to dateadd("h",-18,datetime(currentdate)) and
{TRANS.Crib} in 2 to 2
 

Crystal syntax is a bit unusual when filtering on a range = the keyword is 'in', the values are separated by 'to', and the range values need to be wrapped with square brackets:

{TRANS.TypeDescription} = "ISSUE"
and
{TRANS.Transdate} in [dateadd("h",-18,datetime(currentdate)) to dateadd("h",6,datetime(currentdate))]
and
{TRANS.Crib} in 2 to 2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top