sql - Adding minutes to datetime on insert - mysql -


i've tried this

insert products   (product_id, product_type, created_dt, end_dt)  values   ('11', '1', '2010-10-08 00:11:10', date_sub(2010-10-08 00:11:10, interval 59 minute)) 

but doesn't work. other ways within mysql?

thanks!

use:

insert products    (product_id, product_type, created_dt, end_dt)  values    (11,     '1',     '2010-10-08 00:11:10',      date_add(str_to_date('2010-10-08 00:11:10', '%y-%m-%d %h:%i:%s'), interval 59 minute)   ) 

on mysql 5.1.49, wouldn't add/subtract because wasn't implicitly converting string datetime data type. had use str_to_date explicitly convert string datetime. otherwise, mysql workbench returns blob...


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -