Results 1 to 3 of 3

Thread: question

  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Question Unanswered: question

    How do I figured out what the julian date is of a date?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    date +"%j"

    at least on AIX

  3. #3
    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> |
    +-----------------------+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •