====================== 날짜 수정 할 경우 ========================
mysql> select * from user_info_coin_use;
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
| jumin | date | mode | income | outgo | coin | item_code | item_
num | billing_code |
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
| 11 | 2001-10-10 08:26:52 | 1 | 0 | 0 | 0 | 1 | 1
| bage |
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
1 row in set (0.00 sec)
---- 22일 추가시 ---- ( 예: 10일 전이면 22대신 -10 하면 됩니다. )
mysql> update user_info_coin_use set date=adddate(date, interval 22 day);
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from user_info_coin_use;
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
| jumin | date | mode | income | outgo | coin | item_code | item_num | billing_code |
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
| 11 | 2001-11-01 08:26:52 | 1 | 0 | 0 | 0 | 1 | 1 | bage |
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
1 row in set (0.00 sec)
============================= 오늘 날짜 입력 부분 =====================
mysql> insert into user_info_coin_user values('11',now(),'1',0,0,0,'1','1','bage');
여기서 now() 부분이 현재 시간을 입력하는 부분입니다.
------ 오늘의 날자만 구합니다.
mysql> select curdate() ;
+------------+
| curdate() |
+------------+
| 2001-10-10 |
+------------+
------- 기본 날짜형식으로 오늘의 날짜-시간을 구합니다.
mysql> select now() ;
+---------------------+
| now() |
+---------------------+
| 2001-10-10 08:43:02 |
+---------------------+
mysql> select * from user_info_coin_use;
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
| jumin | date | mode | income | outgo | coin | item_code | item_
num | billing_code |
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
| 11 | 2001-10-10 08:26:52 | 1 | 0 | 0 | 0 | 1 | 1
| bage |
+-------+---------------------+------+--------+-------+------+-----------+------
----+--------------+
1 row in set (0.00 sec)
---- 22일 추가시 ---- ( 예: 10일 전이면 22대신 -10 하면 됩니다. )
mysql> update user_info_coin_use set date=adddate(date, interval 22 day);
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from user_info_coin_use;
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
| jumin | date | mode | income | outgo | coin | item_code | item_num | billing_code |
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
| 11 | 2001-11-01 08:26:52 | 1 | 0 | 0 | 0 | 1 | 1 | bage |
+-------+---------------------+------+--------+-------+------+-----------+----------+--------------+
1 row in set (0.00 sec)
============================= 오늘 날짜 입력 부분 =====================
mysql> insert into user_info_coin_user values('11',now(),'1',0,0,0,'1','1','bage');
여기서 now() 부분이 현재 시간을 입력하는 부분입니다.
------ 오늘의 날자만 구합니다.
mysql> select curdate() ;
+------------+
| curdate() |
+------------+
| 2001-10-10 |
+------------+
------- 기본 날짜형식으로 오늘의 날짜-시간을 구합니다.
mysql> select now() ;
+---------------------+
| now() |
+---------------------+
| 2001-10-10 08:43:02 |
+---------------------+