THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL TIMESTAMP() Function

❮ MySQL Functions

Example

Convert an expression to a datetime value and add a time interval to the value:

SELECT TIMESTAMP("2017-07-23",  "13:10:11");
Try it Yourself »

Definition and Usage

The TIMESTAMP() function converts an expression to a datetime value and if specified adds an optional time interval to the value.

Note: This function will return a datetime value.

Syntax

TIMESTAMP(expression, interval)

Parameter Values

Parameter Description
expression Required. The date or datetime to convert
interval Optional. A time value to add to expression

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1.1

More Examples

Example

Convert an expression to a datetime value:

SELECT TIMESTAMP("2017-07-23");
Try it Yourself »

❮ MySQL Functions