M
M
Maxim Lagoysky2018-08-04 16:35:10
MySQL
Maxim Lagoysky, 2018-08-04 16:35:10

Combining date and time?

There are 2 columns, date and time_end, their types are DATE and TIME respectively.
5b65aa8d549c5912957552.png
The question is how to combine these 2 values ​​​​so that it would be something like 2018-03-15 12:51:30. I know that there is CONCAT, etc. but for some reason, when I combine date and time_end in a line with id=2, then I get 2017-01-04 24:00:00. The question is why am I getting 24 and not 00? and what to do to get 00? I tried converting to types, it didn’t seem to work (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Romashkan, 2018-08-04
@lagoy

select CAST(date as DATETIME) + CAST(time_end as TIME)
from ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question