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!

Formula to change time 1

Status
Not open for further replies.

ccanalia

Technical User
Jul 27, 2004
20
0
0
US
I am using CR 10 with a SQL database and I have a field that I am trying to take any time that was recorded before 9am and display the same date and adjust the time to 9am.

I thought I would be able to use an IF THEN statment but CR tells me that I not only need time, but a date too. What I had was this.

IF {Cases.createDate} < "0900" then "0900"

I want it to keep my same date. Does this make sense?
 
Doesn't make sense to me.

I'll assume that SQL Database means SQL Server database (SQL is a generic language).

Crystal won't "tells me that I not only need time, but a date too", it will give error messages, which you should share if encountered.

SQL Server doesn't have a time type, so I'll assume that you're referring to a datetime type.

This might help:

if time({table.datetimefield}) <= ctime(9,0,0) then
cdatetime(year({table.datetimefield}), month({table.datetimefield}),day({table.datetimefield}),9,0,0)
else
{table.datetimefield}

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top