Add Microsecond to time : TIMESTAMP « Date Time « SQL / MySQL






Add Microsecond to time

     
mysql>
mysql> CREATE TABLE TSTAMP (COL1 TIMESTAMP);
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> SET @TIME = TIMESTAMP('1980-12-08 23:59:59.59');
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> INSERT INTO TSTAMP VALUES (@TIME + INTERVAL 3 MICROSECOND);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT COL1, COL1 + INTERVAL 3 MICROSECOND FROM TSTAMP;
+---------------------+-------------------------------+
| COL1                | COL1 + INTERVAL 3 MICROSECOND |
+---------------------+-------------------------------+
| 1980-12-08 23:59:59 | 1980-12-08 23:59:59.000003    |
+---------------------+-------------------------------+
1 row in set (0.00 sec)

mysql>
mysql> drop table tstamp;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
  








Related examples in the same category

1.The TIMESTAMP column type
2.Displaying TIMESTAMP Values in Readable Form
3.If you modify multiple records, the TIMESTAMP values in all of them will be updated:
4.Table with TIMESTAMP data type
5.Records created from 1 PM to 4 PM:
6.Records modified within the last 12 hours: