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

Convering datatime to time

Status
Not open for further replies.

mnasuto

Technical User
Oct 22, 2001
87
GB
Hi,

I am traing to convert datatime to data an applying it in where statement:

WHERE DATEADD(d, 0, DATEDIFF(d, 0, CaseCloseDate )) = ({ fn CURDATE() })
Now I have to modify it for

WHERE DATEADD(d, 0, DATEDIFF(d, 0, CaseCloseDate + 1 )) = ({ fn CURDATE() })


OR to get

WHERE DATEADD(d, 0, DATEDIFF(d, 0, CaseCloseDate )) = ({ fn CURDATE() }- 1)

First statement is working, but second and third is not.
How to get records with yesterday CaseCloseDate?
CaseCloseDate id datatime type.

Please help if you can

Marta




 
Using the datediff function should suffice
Code:
where datediff(d, caseclosedate, getdate() - 1) = 0

Regards,
AA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top