EN
MySQL - TIMESTEMP() function example
0
points
In this article, we would like to show you TIMESTAMP() function example in MySQL.
Quick solution:
TIMESTAMP(expression);
or
TIMESTAMP(expression1, expression2);
Where:
- expression -
DATEorDATETIMEvalue, - expression1 -
DATEorDATETIMEvalue, - expression2 -
TIMEvalue.
Practical examples
Example 1 - DATE argument
In this example, we will display the timestamp value for the given DATE expression 2021-04-27.
Query:
SELECT TIMESTAMP('2021-04-27');
Result:
Example 2 - DATETIME argument
In this example, we will display the timestamp value for the given DATETIME expression 2021-04-27 19:20:00.
Query:
SELECT TIMESTAMP('2021-04-27 19:20:00');
Result:
Example 3 - DATE and TIME arguments
In this example, we will display the timestamp value for the given DATE and TIME expressions 2021-04-27 and 19:20:00.
Query:
SELECT TIMESTAMP('2021-04-27', '19:20:00');
Result: