To_timestamp method in oracle is used with string (varchar2 or similar) or character sequences to convert it into timestamp type.The function requires the input string of timestamp and the format string as parameters.
Also Read TO_DATE ,TO_CHAR
TO_TIMESTAMP converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of TIMESTAMP data type.
Example:
TO_TIMESTAMP(’12/12/200812:12:12:122222′,’DD/MM/YYYYHH12:MI:SS:FF’)
Optional parameters
1.The optional fmt specifies the format of char.
2.The optional ‘nlsparam’ argument has the same purpose in this function
See the example output below.
SQL> SQL> select to_timestamp('12/12/2008 12:12:12:122222', 'DD/MM/YYYY HH12:MI:SS:FF') from dual; TO_TIMESTAMP('12/12/200812:12:12:122222','DD/MM/YYYYHH12:MI:SS:FF') 12-DEC-08 12.12.12.122222000 PM< SQL>
Read,
- Oracle DATE vs TIMESTAMP |Comparing Oracle DATE and TIMESTAMP Datatypes
- Oracle to_char function and usage
- Using oracle date format |Using the DATE Format Mask in pl/sql
- Oracle comparing dates : dates, oracle, date comparison in oracle pl/sql
- ORA-01882: TIMEZONE REGION NOT FOUND |Oracle Error
- PL/SQL EXTRACT function for oracle datetime
- ALTER TABLE to ADD PRIMARY KEY in Oracle| Oracle ALTER TABLE
- oracle date difference | date difference in sql an…
- DATE Data type in Oracle|Oracle Dates and Times|Dates in Oracle
- Formatting date in SQL (Oracle) -Simple date forma…
- Database Schema | Oracle Schema Objects | What is database schema?
- Autonomous Transactions in PL/SQL
- SQL – Transaction Statements -Transaction Manageme…
Technorati Tags:
Datetime, to_timestamp, to_char, to_date, CHAR, VARCHAR2, NCHAR, NVARCHAR2, nlsparam, fmt
Pingback: Oracle Trim Function | PL/SQL TRIM() Function. | SQL and PLSQL
Pingback: Oracle timestamp format milliseconds| Oracle Date format | SQL and PLSQL