Jump to: navigation, search

Mysql TIMESTAMP

From w3cyberlearnings

Contents

MySQL TIMESTAMP Function

This function returns a datetime value from a date or datetime expression. When there are two inputs, the first adds with the second and it returns the timestamp result.

Syntax TIMESTAMP

  • input1: a date or datetime string
  • input2: a date or datetime string
TIMESTAMP(input1, input2);

Example 1

mysql> SELECT TIMESTAMP('2012-04-20');
+-------------------------+
| TIMESTAMP('2012-04-20') |
+-------------------------+
| 2012-04-20 00:00:00     |
+-------------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT TIMESTAMP('2012-04-20 03:00:00','04:00:00');
+---------------------------------------------+
| TIMESTAMP('2012-04-20 03:00:00','04:00:00') |
+---------------------------------------------+
| 2012-04-20 07:00:00                         |
+---------------------------------------------+
1 row in set (0.00 sec)


Related Links



Navigation
Web
SQL
MISC
References