Convert from Date and Time only Time and Minutes in SQL

0

Good morning I have this query

convert(char(8), Horario.HoraInicio, 108)

but when I give it run I get 00:00:00 but yosolo I want me to% of 00:00

some idea,

Thanks

    
asked by Christian Guerra Huertas 23.10.2018 в 18:29
source

2 answers

0

With the function TIME_FORMAT you specify what you want for example hours, minutes and seconds '%H:%i:%s' in your case you only need hours and minutes that is why '%H:%i' is used. With the function time you get the time of any date-time.

SELECT TIME_FORMAT(TIME('2018-01-01 22:52:59'),'%H:%i');
    
answered by 23.10.2018 в 19:05
0

This is done in TSQL:

convert(char(5), GETDATE(), 108)

You can look here: link

    
answered by 24.10.2018 в 20:38