Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to obtain current date with max datetime using sql convert function?

I mean i want date as 2014-05-30 23:59:59 instead of 2014-05-30 00:00:00.000 in sql using convert function.
Posted
Comments
syed shanu 29-May-14 4:47am    
Do you want getdate() with max time of the day . chk this

select getdate() as getdate,
convert (varchar(10),getdate(),126) + ' 23:59:59' as ConvertedFormat

1 solution

Ah...
Try:
SQL
SELECT CONVERT(NVARCHAR(19), DATEADD(s, -1, DATEADD(dd, 1, DATEDIFF(dd, 0, GETDATE()))), 120)
 
Share this answer
 
Comments
CHill60 29-May-14 4:48am    
Nice! 5'd
Shanalal Kasim 29-May-14 4:55am    
Nice

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