Home » SQL & PL/SQL » SQL & PL/SQL » Convert SYSDATE to Julian Date format (Oracle DB 10205)
Convert SYSDATE to Julian Date format [message #620176] Tue, 29 July 2014 13:26 Go to next message
praveenramaswamy
Messages: 34
Registered: December 2013
Member
Dear All

Can you please guide me how to convert a SYSDATE into Julian Date Format (0YYDDD)
Re: Convert SYSDATE to Julian Date format [message #620178 is a reply to message #620176] Tue, 29 July 2014 13:32 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
praveenramaswamy wrote on Tue, 29 July 2014 11:26
Dear All

Can you please guide me how to convert a SYSDATE into Julian Date Format (0YYDDD)


IMO, what you ask for is NOT Julian date.

what is desired/ expected results for January 1 0014?

what is desired/ expected results for January 1 0914?

what is desired/ expected results for January 1 1914?

what is desired/ expected results for January 1 2014?

Re: Convert SYSDATE to Julian Date format [message #620182 is a reply to message #620178] Tue, 29 July 2014 13:38 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
YYDDD is not a julian date format.
Julian date is a number of days since a particular date.
If you want YYDDD then just use to_char with that format mask.
Re: Convert SYSDATE to Julian Date format [message #620183 is a reply to message #620178] Tue, 29 July 2014 13:40 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>what is desired/ expected results for January 1 2014? --- in the format YYDDD
foolish & unprofessional format & results.
why repeat Y2K error again, again?
Years has 4 digit values!


SQL> select to_char(sysdate,'RRDDD') from dual;

TO_CH
-----
14210


>10205
is above July 24, 2010?

when all else fails, Read The Fine Manual

http://docs.oracle.com/database/121/SQLRF/sql_elements004.htm#SQLRF51078

[Updated on: Tue, 29 July 2014 13:52]

Report message to a moderator

Re: Convert SYSDATE to Julian Date format [message #620187 is a reply to message #620183] Tue, 29 July 2014 15:31 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As of the question itself, it is TO_CHAR with appropriate format mask you need:
SQL> select to_char(sysdate, 'j') from dual;

TO_CHAR
-------
2456868

SQL>

I'm not sure what "0YYDDD" is supposed to mean so - either you don't need a Julian date, or you do but don't know what it is (number of days since January 1st 4712 BC).
Previous Topic: Global Temp Table
Next Topic: need the output
Goto Forum:
  


Current Time: Fri Apr 26 11:23:51 CDT 2024