1834116 Members
2445 Online
110063 Solutions
New Discussion

Julian date format

 
SOLVED
Go to solution
Rick Elliott
Occasional Contributor

Julian date format

I have a user who is in the process of writing a script and needs to convert the date values he has into Julian Date format. Therefore if he enters March 10th he needs to know what the Julian date value would be. Obviously I can get the current value using date +%j but I need to calculate the value based on whatever date is entered, can anybody assist on this matter, is there an esay way of doing this.
3 REPLIES 3
Rodney Hills
Honored Contributor

Re: Julian date format

Clay has a neat tool called caljd.sh,

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xea948cc5e03fd6118fff0090279cd0f9,00.html

(I found the link by using the "search" capability of the forum and plugging in "julian" for the keyword...)

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Julian date format

Hi Rick:

The julian date returned by date '+%j' is NOT a Julian date. Julian days are used by astronomers to count days sequentially from ~4713BCE. The good news is that the attached script will do julian days and can convert month, day, year to a julian day and will convert a julian day to month, day, year.

Caljd.sh -u will give full usage.

Simple example:

caljd.sh 9 15 2002
will output 2452533

caljd.sh 2452533
will output 09 15 2002



If it ain't broke, I can fix that.