Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Print sysdate in mm/dd/yyyy format and timestamp should be hardcorded as per our need.

bhaskar_subbiahNov 25 2016 — edited Nov 25 2016

Hi experts,

Here is a simple experiment i tried, but not working, help me if you have idea.

i want to print (sysdate-1) and thats easy, but i need (sysdate-1) with time stamp hardcorded.. I mean, below is rough query but it will not work

SELECT trunc(SYSDATE-1)||'23:59:59' FROM dual   <- this is rough query

When i run the above query the result is coming as '24-NOV-16 23:59:59'' If it comes with dd/mm/yyy format with my hardcorded timestamp i could have been happy..But its not coming in that way.

trunc(sysdate-1) should print output as '11/24/2016' .Also with this i need to print hard-corded time stamps. so i need output as 11/24/2016 23:59:59 .Here the timestamp i should put along with the datestamp..

you may ask why this is needed, but i need to put this as inner query in another one query for validation.So this is needed.

Please help me with this .!

Thanks and warm regards

Bhaskar.S

This post has been answered by RogerT on Nov 25 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2016
Added on Nov 25 2016
23 comments
6,926 views