Doubt in datecalc.....


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Doubt in datecalc.....
# 1  
Old 02-14-2009
Doubt in datecalc.....

I have a doubt in date conversion. Can anyone explain the logic behind the date2jd and jd2date in datecalc function specified in this forum. I could not understand what the number are actually representing. Please explain...bcoz i am doing a program with this one..

Note: No need to specifically explain the function in datecalc...in general also...u can explain...i want to know the logic behind it in a logical manner...
# 2  
Old 02-14-2009
I wrote those functions and I cannot explain them. I surfed the web and found date calculation routines in a variety of languages. I converted to ksh and benchmarked them. I took the fastest routines and used them. I gave datecalc a finite range, 1860 to 3999. 1860 is when the US bought Alaska and mandated that Alaska migrate from the julian to the gregorian calendar. Whether or not the year 4000 will be a leap year is controversial.

I manually verified that Jan 1, 1860 works right. Then I used a verification script to generate the dates between 1860 and 3999 by incrementing the day, month, and year. Each date was fed to datecalc for conversion to modified julian day. The script verified that the mjd incremented by 1 each day. The mjd was fed to datecalc for conversion back to year, month, and day and this final output was compared to the original date. So I know for sure that the routines work between the limits I set.

I don't understand the algorithms. But I know that they work. Calendar algorithms are not worth studying. Why not study an interesting algorithm instead? For example: how to accurately calculate x^y in extended floating point using only extended floating point for all intermediate calculations? I've been trying to figure that one out all week. It's much harder than it looks.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Doubt

in my shell script requirement is to search and replace the file with variable so i use the following command sed -i "s/abc/$SCHEMA/g" table.sql later when the script runs sqlplus username/pwd@Table& this & is not letting the variable to replace the value inside the file .please let me know... (1 Reply)
Discussion started by: bhuvan1
1 Replies

2. Red Hat

Doubt

How to create a file with specific size in RHEL6 (1 Reply)
Discussion started by: Sashi Kanth A
1 Replies

3. Shell Programming and Scripting

How to subtract time by 10 minutes in datecalc tool

Hi guys. I am trying to subtract 10 minutes from the current Unix system date and time. I have the datecalc provided here but it is mainly the date and not the time. Please check on how can i subtract 10 minutes from the current time using datecalc or any other shell scripting that will... (2 Replies)
Discussion started by: bantiloe
2 Replies

4. UNIX for Dummies Questions & Answers

Doubt

How would i create virtual interface in linux to configure more than one IP address for a physical interface? any help wll be appreciated. (1 Reply)
Discussion started by: salil2012
1 Replies

5. Shell Programming and Scripting

Doubt??

I jus want to know the meaning of the below command line(exclamation following that re-direction) sqlplus -s `cat /home/sample.txt` <<! Thanks!! (1 Reply)
Discussion started by: nohup
1 Replies

6. UNIX for Dummies Questions & Answers

How to use datecalc for adding hours

Hello: I need to generate two datetimestamps in one hour apart. the start date is 05262008000000 then generate the following dates 05262008010000 05262008020000 05262008030000 ... ... ... ... ... ... 05262008230000 05272008000000 05272008010000 05272008020000 05272008030000 ...... (5 Replies)
Discussion started by: ucbus
5 Replies

7. Shell Programming and Scripting

datecalc question.

I have a script that works perfectly on a linux box, but I am going to have to move it over to solaris which I have never really worked with. I was a bit miffed that date -d was not available on solaris so I started looking for alternative soltuoins and found this forum and datecalc. But I... (4 Replies)
Discussion started by: trey85stang
4 Replies

8. Shell Programming and Scripting

datecalc

Is there no simple way using 'date' command just to get number of days from given date. ie. if I pass 2007-01-15 as an argument. I want to obtain result as 015 Simarly for 2007-02-10. I want to obtain result as 41. Can't this be achieved by simple 1 or 2 lines of command (date). As this is... (1 Reply)
Discussion started by: tostay2003
1 Replies

9. Shell Programming and Scripting

Need a help Please- runing the perderabos script datecalc

i have a script in bourne called cdrsnokia.sh and inside of it calls a script called resta_dias where it calls the datecalc script (perderabos date calculator). The purpose is to rest (-) one day arithmetical operation the content of each line and the result is passed to another file lista2;after... (1 Reply)
Discussion started by: alexcol
1 Replies
Login or Register to Ask a Question