TO_TIMESTAMP
TO_TIMESTAMP(x)
converts the string x to a TIMESTAMP
.
The format is:
to_timestamp( x, [ format_mask ] [ 'nlsparam' ] )
- x is the string to be converted to a timestamp.
- format_mask, optional, is the format.
The format_mask list:
Parameter | Description |
---|---|
YYYY | 4-digit year |
MM | Month (01-12; JAN = 01). |
MON | Abbreviated name of month. |
MONTH | Name of month, padded with blanks to length of 9 characters. |
DD | Day of month (1-31). |
HH | Hour of day (1-12). |
HH12 | Hour of day (1-12). |
HH24 | Hour of day (0-23). |
MI | Minute (0-59). |
SS | Second (0-59). |
SQL> select to_timestamp('2012/07/13 11:13:21', 'YYYY/MM/DD HH:MI:SS') from dual;
TO_TIMESTAMP('2012/07/1311:13:21','YYYY/MM/DDHH:MI:SS')
---------------------------------------------------------------------------
13-JUL-12 11.13.21.000000000 AM
SQL> select to_timestamp('2012/JUL/13 11:13:21', 'YYYY/MON/DD HH:MI:SS') from dual;
TO_TIMESTAMP('2012/JUL/1311:13:21','YYYY/MON/DDHH:MI:SS')
---------------------------------------------------------------------------
13-JUL-12 11.13.21.000000000 AM
SQL>