MySQL TIMESTAMP() Function

MySQL | TIMESTAMP() Function: Learn about the TIMESTAMP() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 12, 2022

TIMESTAMP() Function

The TIMESTAMP() function converts the expression into the datetime. This function is used to get the date or datetime expression if there is a single argument, if there are two arguments this function is used to get the sum of the given arguments.

TIMESTAMP() Syntax

SELECT TIMESTAMP(expression, time expression);

TIMESTAMP() Parameter(s)

  • expression: This belongs to the datetime value which you want to convert.
  • time expression or interval: This parameter is optional. Whatever interval you will write here will be added to the datetime value.

TIMESTAMP() Return Value

As a result, it will return you the datetime value.

MySQL TIMESTAMP() Function Example 1

SELECT TIMESTAMP('2022-09-12');
Example 1: MySQL TIMESTAMP() Function

MySQL TIMESTAMP() Function Example 2

SELECT TIMESTAMP('2022-09-12 12:09:09');
Example 2: MySQL TIMESTAMP() Function



Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.