Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how do i retrieve date diff with full format that show day,month,year at same time
Posted
Comments
walterhevedeich 7-Jul-11 2:02am    
Your question is unclear? Do you mean you want to output a result from a datediff function in that format?
[no name] 7-Jul-11 2:04am    
please describe more.
Corporal Agarn 7-Jul-11 14:09pm    
Do you want DATEADD? Say SELECT DATEADD(day, -30, GETDATE())???

 
Share this answer
 
You can't. Even the stored procedure approach that Prerak recommends has a fatal flaw: there is no SQL date format that allows year or month zero. See MSDN[^]
I would strongly recommend that you instead return a number of days between the two dates
SELECT DATEDIFF(day, [date], GETDATE()) FROM myTable
and process that into a date if you really need it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900