Languages
[Edit]
EN

MySQL - TIMESTEMP() function example

0 points
Created by:
Dirask Community
6240

In this article, we would like to show you TIMESTAMP() function example in MySQL.

Quick solution: 

TIMESTAMP(expression);

or 

TIMESTAMP(expression1, expression2);

Where:

  • expression - DATE or DATETIME value,
  • expression1 -┬áDATE or DATETIME value,
  • expression2 -┬á TIME value.

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:

MySQL - TIMESTAMP() function result
MySQL - TIMESTAMP() function 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:

MySQL - TIMESTAMP() function result
MySQL - TIMESTAMP() function 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:

MySQL - TIMESTAMP() function result
MySQL - TIMESTAMP() function result

MySQL - dates

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join