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!

conversion date to specific timestamp format

User_5OAFPSep 11 2017 — edited Sep 11 2017

Hello,

Our database stores column as date but we need to convert it to specific timestamp format, for example: "01/31/1970T12:04:12.000GMT+00:00".

It is now done as:

select

  to_char( cast(sysdate as timestamp(3) with local time zone)

         , 'MM/DD/YYYY"T"HH24:MI:SS.FF"GMT+00:00"' )

from dual;

As you can see it has

  • hardcoded time zone part
  • looks a bit ugly

The requirement is that it must contain timezone expressed as "GMT<+/-><hours:minutes>" and "T" letter between <date> and <time> part of a datetime (BTW: is this some generic format for timestamps?). Can the format above be obtained in better way? The less hardcoding the better...

Thank you

This post has been answered by cormaco on Sep 11 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2017
Added on Sep 11 2017
8 comments
438 views