Date format with UTC [message #681128] |
Thu, 18 June 2020 03:35 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/f9d5bad645b99b0041cdd245f0d925e0?s=64&d=mm&r=g) |
Mark70
Messages: 18 Registered: June 2020
|
Junior Member |
|
|
Hi,
I have to select the value 2019-03-25 from a date column of a table but in the following format:
2019-03-25T00:00:00.000+02:00
Hon can I get it?
Oracle 10g
Thanks!
[Updated on: Thu, 18 June 2020 03:53] Report message to a moderator
|
|
|
Re: Date format with UTC [message #681129 is a reply to message #681128] |
Thu, 18 June 2020 04:00 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
You need to use appropriate format elements, for example,R19 orclz> select to_char(systimestamp,'yyyy-mm-dd hh24:mi:ssTZH:TZM') from dual;
TO_CHAR(SYSTIMESTAMP,'YYY
-------------------------
2020-06-18 09:58:31+01:00
R19 orclz>
|
|
|
|
Re: Date format with UTC [message #681170 is a reply to message #681132] |
Mon, 22 June 2020 07:18 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
If the table column is of type DATE and not TIMESTAMP you would do the following where you would replace the function SYSDATE with the name of the column
select to_char(cast(sysdate AS TIMESTAMP WITH TIME ZONE),'yyyy-mm-dd hh24:mi:ssTZH:TZM') from dual;
2020-06-22 08:17:27-04:00
[Updated on: Mon, 22 June 2020 07:21] Report message to a moderator
|
|
|
|