ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The above command is wroking on linux but not on unix. I am trying to go through the manual pages for 'date' command, so far unable to get the same result on unix system.
The above command is wroking on linux but not on unix. I am trying to go through the manual pages for 'date' command, so far unable to get the same result on unix system.
Not on my Linux!!! (PCLOS 2007)
My output:
Code:
[mherring@localhost ~]$ date -d '2007-04-01' +'%Y %j'
2007 091
The accepted and precise meanings of the term may be a sub-issue here.
Quote:
The use of Julian date to refer to the day-of-year (ordinal date) is usually considered to be incorrect, however it is widely used that way in the earth sciences and computer programming.
In Chapter 8 he has a number of functions for date manipulation. Some appear to deal with "Julian". I have not tried them.
There are several algorithms in pseudo-code that IBM published just before Y2K. I have listed the contents below. If you really cannot find anything else, I can post the algorithms. IBM seems to have archived them -- I cannot find them on their web page http://www.software.ibm.com/year2000/tips15.html -- perhaps you would have better luck than I did -- or perhaps you can Google for them. You would need to translate those into shell scripts. I did a few in perl just to check them out.
Finally, sourceforge has a number of codes for Julian, but they appear to be the real Julian date forms.
Best wishes ... cheers, makyo
Quote:
Date Calculation Algorithms
These algorithms should be implemented using 32 bit or 9 digit
precision arithmetic in the computer language of your choice. All
division is integer division, i.e. you drop the remainder. For
example, 35 / 4 is 8; to make this clear the algorithms use the INT
function, INT(35/4). These algorithms make use of the MOD function,
the remainder after integer division.
The following algorithms are included:
* Convert from YYYY,MM,DD to YYYY,NNN and determine day-of-week
* Convert from YYYY,NNN to YYYY,MM,DD and determine day-of-week
* Convert from YYYY,NNN to Lilian (day 1=Fri Oct 15, 1582)
* Convert from Lilian to YYYY,NNN
* Convert from Lilian to day-of-week
* Convert from YYYY,MM,DD to YYYY,NNN
* Convert from YYYY,MM,DD to day-of-week
NOTE: Day 1 of the Lilian date in these algorithms is Friday, 15
October 1582.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.