The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Days difference between two dates Data469 Shell Programming and Scripting 6 03-26-2008 12:32 PM
compare dates ragha81 Shell Programming and Scripting 2 11-01-2006 03:17 PM
How to get the difference between dates?Can i treat as string? EDBGSK Shell Programming and Scripting 3 10-25-2006 09:18 AM
Difference between two dates in no of days ??? csaha Shell Programming and Scripting 1 01-13-2006 03:44 AM
Searching between dates Khoomfire Shell Programming and Scripting 9 08-22-2005 08:11 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-03-2006
Registered User
 

Join Date: Feb 2005
Location: Bangalore
Posts: 36
Difference between two dates...

Hi All,
Wish you a Happy New year...

I have to find the difference between two dates, the result should be the number of days. I have seen the "datecalc" function. Its good, can I have any other alternative.

Thanks in Advance
Raju
Reply With Quote
Forum Sponsor
  #2  
Old 01-03-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Quote:
Originally Posted by rajus19
I have seen the "datecalc" function. Its good, can I have any other alternative.
Why re-invent the wheel again ?

Search through Yesterdays Date/Date Arithmetic
Reply With Quote
  #3  
Old 01-04-2006
Registered User
 

Join Date: Feb 2005
Location: Bangalore
Posts: 36
Logic behind date2jd function??

Thanks for the response.
Can you pls explain the part of logic behind date2jd.

((standard_jd = day - 32075
+ 1461 * (year + 4800 - (14 - month)/12)/4
+ 367 * (month - 2 + (14 - month)/12*12)/12
- 3 * ((year + 4900 - (14 - month)/12)/100)/4))
((jd = standard_jd-2400001))

Regards,
Raju
Reply With Quote
  #4  
Old 01-04-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Perderabo picked up the algorithm from the internet.

Googling gave me this - Julian Day Numbers

Read through 9.Conversion Algorithms. That should answer your question.

Vino
Reply With Quote
  #5  
Old 01-04-2006
Registered User
 

Join Date: Feb 2005
Location: Bangalore
Posts: 36
Thanks Vino
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0