tags:

views:

15

answers:

1

I cant seem to get this to work, It returns Null

SELECT sdt, timeFor, DATE_ADD(TIMESTAMP(sdt), INTERVAL timeFor MINUTE) FROM tbl_day

The return keeps returning

sdt, timeFor, DATE_ADD(TIMESTAMP(sdt), INTERVAL timeFor MINUTE)
'0000-00-00 01:00:00', 15, ''

Columns Type

  • sdt DATETIME
  • timeFor BIGINT(20)

Any ideas

+1  A: 

MySQL usually returns NULL on date/time operations when column value is incomplete datetime. Something like 2010-00-05 11:22:33, etc. Also using timestamp function on sdt column might not be a good idea. I'd suggest providing normal datetime value.

Eimantas
The output shows there are no spaces, I didnt type the output in my question this was a copy and paste from the query browser
Shahmir Javaid
`SELECT *, DATE_ADD(sdt, INTERVAL timeFor MINUTE) FROM schedule_day`, tried that same output
Shahmir Javaid
You genious it was the invalid values of the DATETIME. Thanks You
Shahmir Javaid