If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-05, 12:57
jazevedo jazevedo is offline
Registered User
 
Join Date: Aug 2004
Posts: 5
Question question

How do I figured out what the julian date is of a date?
Reply With Quote
  #2 (permalink)  
Old 09-27-05, 14:52
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
date +"%j"

at least on AIX
Reply With Quote
  #3 (permalink)  
Old 09-27-05, 17:37
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
Quote:
Originally Posted by jazevedo
How do I figured out what the julian date is of a date?
here's a simple script [date2julian] for those of us who have julian-challenged 'date':

$ julian2date 09 27 2005
1727082

Code:
#!/bin/ksh

date2julian() #  day month year
{
  typeset year=$1;  typeset month=$2;  typeset day=$3
  tmpmonth=$((12 * year + month - 3))
  tmpyear=$((tmpmonth / 12))
  print $(( (734 * tmpmonth + 15) / 24 -  2 * tmpyear + \
    tmpyear/4 - tmpyear/100 + tmpyear/400 + day + 1721119 ))
}

date2julian "$1" "$2" "$3"
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On