Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    South Africa
    Provided Answers: 1

    Unanswered: Date calculator for date manipulation

    Anyone interested?
    I've created a script for date calculations,
    dateadd, datediff, Julian day number conversion and formatting

    Syntax: datecalc [-j] [-f <out_date_format>] <function> <args>

    Dates are dates in the proleptic Gregorion Calendar
    for Julian Calendar dates use -j flag

    e.g. current date: 2005-10-24
    How many days to new year?
    datecalc datediff 2006 1 1 `date '+%Y %m %d'`
    end of last month
    datecalc -f "dddd, d mmmm yyyy (Week ww)" dateadd `date '+%Y %m'` 1 -1
    Friday, 30 September 2005 (Week 39)
    The last day Great Britain used the Julian calendar was 1752-09-02
    wat was the julian day number and what was the next date

    datecalc -j jd 1752 9 2 # Get julian day number
    echo $(datecalc -f 'ddd yyyy-mm-dd' jc 2361221) was followed\
    by $(datecalc -f 'ddd yyyy-mm-dd' gc 2361222)
    Wed 1752-09-02 was followed by Thu 1752-09-14
    How many days to drop in 1582 when Italy changed
    from the Julian calendar to the Gregorian calendar

    echo $(( $(datecalc -j jd 1582 10 4) - $(datecalc jd 1582 10 4) ))
    ordinal day number in particular year (like date +%j)
    datecalc od 2004 3 1
    what is the gregorian calendar date for ordinal date 2004-60
    datecalc -f "yyyy-mm-dd" gc 2004 60
    On what date is easter in 2010
    datecalc -f "d-mmm-yyyy" easter 2010
    ISO 8601 week number (yyyy-Www-d) for 2005-01-01
    datecalc isoweek 2005 1 1

  2. #2
    Join Date
    May 2005
    South Africa
    Provided Answers: 1

    Script for date calculations

    Sorry, I forgot to attach the script. Here it is.
    Attached Files Attached Files

Posting Permissions

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