milheiros milheiros - 2 months ago 36
SQL Question

Timezone date format in Oracle

I have to convert a

date to a specific date format. That format must be something like this:
. I think this is a weird date format but is the requirements that I have.

This must be a date to send in a Web Service message.

In Oracle (12c or 11g) I have some function to transform a date in this specific format? Thanks.


That will give you ISO-8601 mentioned in comment:

select to_char(systimestamp,'YYYY-MM-DD"T"hh24:mi:sstzh:tzm') isodt from dual;

If you really want Z instead of timezone you can use:

    select to_char(cast(systimestamp as timestamp) at time zone 'UTC',
    from dual;