Zeroing datetime time with SQL

2

Today my SELECT returns the following date:

2017-11-16 10:37:16.000

I would like to return 2017-11-16 00:00:00.000 , can you help me with this formatting?

    
asked by anonymous 17.11.2017 / 19:09

2 answers

1

You can use the format and move the time zone to zero. Ex:

SELECT FORMAT(GETDATE(), 'yyyy-MM-dd 00:00:00') AS DATE;
    
17.11.2017 / 19:28
0

Another option would look like this:

 SELECT to_char(DATA, 'yyyy-MM-dd 00:00:00.000') AS DATE from TBL_DATAS;
    
17.11.2017 / 19:30