I wrote this a few years ago - I think it still works :) I called it add_days and then executed add_days -1=20 to get yesterday Cheers, Ian MONTHS=3DJan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec MONDAYS=3D31:28:31:30:31:30:31:31:30:31:30:31 TDAY=3D$(date +%e) TMON=3D$(date +%m) TYER=3D$(date +%Y) let LEAP_YEAR=3D$TYER%4 let TOTDAYS=3DTDAY+${1:-0} MONDAY=3D$(echo $MONDAYS|cut -d: -f$TMON) if [ $TMON -eq 2 ] && [ $LEAP_YEAR -eq 0 ] && [ $TYER -ne 2000 ] then let MONDAY=3D$MONDAY+1 fi while [ $TOTDAYS -gt $MONDAY ] do let TOTDAYS=3D$TOTDAYS-$MONDAY let TMON=3D$TMON+1 if [ $TMON -eq 13 ] then TMON=3D1 let TYER=3D$TYER+1 fi MONDAY=3D$(echo $MONDAYS|cut -d: -f$TMON) if [ $TMON -eq 2 ] && [ $LEAP_YEAR -eq 2 ] && [ $TYER -ne 2000 ] then let MONDAY=3D$MONDAY+1 fi done echo $TOTDAYS $(echo $MONTHS|cut -d: -f$TMON) $TYER This email is only intended for the person to whom it is addressed and may = contain confidential information. If you have received this email in error,= please notify the sender and delete this email which must not be copied, d= istributed or disclosed to any other person. Unless stated otherwise, the contents of this email are personal to the wri= ter and do not represent the official view of Ordnance Survey. Nor can any = contract be formed on Ordnance Survey's behalf via email. We reserve the ri= ght to monitor emails and attachments without prior notice. Thank you for your cooperation. Ordnance Survey Romsey Road Southampton SO16 4GU Tel: 023 8079 2000 http://www.ordnancesurvey.co.uk -- //www.freelists.org/webpage/oracle-l