In Oracle, to get the current timestamp, use SYSTIMESTAMP
, and if you want to convert timestamp to date, use the CAST()
function. Below is an example:
Using CAST() Function to Convert Timestamp to Date in Oracle
The following is the SQL query using the CAST()
function to convert systimestamp
to date:
select cast(systimestamp as date) from dual;
Below is an example convert timestamp to date using PL/SQL
Declare t_timestamp timestamp := systimestamp; d_date date; Begin d_date := cast(t_timestamp as date); dbms_output.put_line(d_date); end;
Leave a comment
You must login or register to add a new comment.