totn MariaDB Functions

MariaDB: TIMESTAMP Function

This MariaDB tutorial explains how to use the MariaDB TIMESTAMP function with syntax and examples.

Description

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

Syntax

The syntax for the TIMESTAMP function in MariaDB is:

TIMESTAMP( expression, [ interval ] )

Parameters or Arguments

expression
A date or datetime value.
interval
Optional. It is a time value to add to the expression.

Note

  • The TIMESTAMP function will return a datetime value.

Applies To

The TIMESTAMP function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB TIMESTAMP function examples and explore how to use the TIMESTAMP function in MariaDB.

For example:

SELECT TIMESTAMP('2014-11-17');
Result: '2014-11-17 00:00:00'

SELECT TIMESTAMP('2014-11-17', '07:32:00');
Result: '2014-11-17 07:32:00'

SELECT TIMESTAMP('2014-11-18 10:05:00', '02:03:04');
Result: '2014-11-18 12:08:04'