June 15, 2017 at 1:25 pm
how to get it more directly than this?
SELECT CONVERT(VARCHAR(25), getdate(), 101) + ' 12:00:00 AM'
i need 12:00:00 AM in all rows.
--Quote me
June 15, 2017 at 1:42 pm
polkadot - Thursday, June 15, 2017 1:25 PMhow to get it more directly than this?
SELECT CONVERT(VARCHAR(25), getdate(), 101) + ' 12:00:00 AM'i need 12:00:00 AM in all rows.
That's the easiest way to do it in T-SQL. For a more direct (and preferred) way, just do it in the front end.
June 15, 2017 at 1:59 pm
SELECT Cast(MyDatetime, as date) FROM MyTable;
June 16, 2017 at 3:21 am
Piling on
😎
This returns a DATETIME with time set at midnight:SELECT CONVERT(DATETIME,CONVERT(DATE,GETDATE()),0)
June 16, 2017 at 5:38 am
Here's a post by Lynn with some common date routines. http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/
It's a good one to bookmark if you work with dates frequently.
June 19, 2017 at 12:51 am
hi,
I think this is what you want.. please check this will work for you.
SELECT CONVERT(VARCHAR(50),GETDATE(),101) + ' ' +right(convert(varchar(20),GETDATE(),100),7)
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply