Cookies Cookies - 29 days ago 8
MySQL Question

Combining three fields as date - MySQL

Say I have three fields,

date
,
time
,
ETA
, how would I combine them all into 1 output -
resultDate
?

Date
(date type) is 2016-02-02

Time
(time type) is 23:45:00

ETA
(int type) is 19 minutes

so, the result would ideally be:
2016-02-03 00:04:00

Answer
select timestamp('2016-02-02', '23:45:00') + interval 19 minute

returns '2016-02-03 00:04:00'

So in your case you can use

timestamp(Date, Time) + interval ETA minute
Comments