To add two weeks to a date in MySQL, use DATE_ADD() −
insert into yourTableName(yourColumnName) values(date_add(now(),interval 2 week));
Let us first create a table −
mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ShippingDate datetime ); Query OK, 0 rows affected (0.62 sec)
Following is the query to get the current date −
mysql> select now(); +-----------------------+ | now() | +-----------------------+ | 2019-06-02 10 :36 :49 | +-----------------------+ 1 row in set (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(ShippingDate) values(date_add(now(),interval 2 week)); Query OK, 1 row affected (0.22 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
Output
+----+-----------------------+ | Id | ShippingDate | +----+-----------------------+ | 1 | 2019-06-16 10 :37 :24 | +----+-----------------------+ 1 row in set (0.00 sec)