The TIMESTAMP function returns a timestamp from a value or a pair of values.


TIMESTAMP ( expression1 [, expression2 ] )


If expression2 is also specified, expression1 must be a date or a valid string representation of a date.

If only expression1 is specified, it must be one of the following:

  • A  DATE value
  • A valid SQL string representation of a timestamp


(Optional). A time or a valid string representation of a time.


The data type of the result depends on how the input expression(s) were specified:

  • If both expression1 and expression2 are specified, the result is a timestamp with the date specified by expression1 and the time specified by expression2. The microsecond part of the timestamp is zero.
  • If only expression1 is specified and it is a timestamp, the result is that timestamp.
  • If only expression1 is specified and it is a string, the result is the timestamp represented by that string. If expression1 is a string of length 14, the timestamp has a microsecond part of zero.


This example converts date and time strings into a timestamp value:

splice> VALUES TIMESTAMP('2015-11-12', '19:02:43');
2015-11-12 19:02:43.0

1 row selected

This query shows the timestamp version of the birth date of each player born in the final quarter of the year:

splice> SELECT TIMESTAMP(BirthDate)
   FROM Players
   WHERE MONTH(BirthDate) > 10
   ORDER BY BirthDate;
1980-12-19 00:00:00.0
1983-11-06 00:00:00.0
1983-11-28 00:00:00.0
1983-12-24 00:00:00.0
1984-11-22 00:00:00.0
1985-11-07 00:00:00.0
1985-11-26 00:00:00.0
1985-12-21 00:00:00.0
1986-11-13 00:00:00.0
1986-11-24 00:00:00.0
1986-12-16 00:00:00.0
1987-11-12 00:00:00.0
1987-11-16 00:00:00.0
1987-12-17 00:00:00.0
1988-12-21 00:00:00.0
1989-11-17 00:00:00.0
1991-11-15 00:00:00.0

17 rows selected

See Also