i have the next query:
select avHours, date_add('2010-01-20', Interval 2 DAY) from tbl_available order by avHours;
but it returns a blob field and not a date field. when i see the value in the blob field, it's the right date.
how can i fix this?
Thanks in advance!
DATE_ADD() function in MySQL is used to add a specified time or date interval to a specified date and then return the date.
The default way to store a date in a MySQL database is by using DATE. The proper format of a DATE is: YYYY-MM-DD.
MySQL functions sometimes converts to BLOB. You can fix it if you will cast result to a DATE type yourself, for example -
SELECT DATE(DATE_ADD('2010-01-20', INTERVAL 2 DAY))
or
SELECT CAST(('2010-01-20' + INTERVAL 2 DAY) AS DATE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With