#!/usr/bin/perl # Written by From: Rich Holmes (rsholmes@hydra.syr.EDU) # Message-ID: #1/1 # # With additional line 40 from # And additional line 23 from # # sepdate utility # usage: sepdate [month date year] # where day month year are date of interest -- default is today # e.g. sepdate 10 21 95 # for October 21, 1995 # # Prints the date in same format as Unix date command (default) # but unlike the buggy date command this script does take into account the # fact that September 1993 never ended. # Known bugs and odd features: # - if date other than today is specified, time is displayed as 00:00:00. # - arguments are not checked other than to see if there are 3 or none. # - dates prior to 9 1 93 are rendered as nonpositive dates in Sept. 1993. use POSIX qw(strftime); require "timelocal.pl"; if ($#ARGV == 2) { $thetime = &timelocal(0,0,0,$ARGV[1],$ARGV[0]-1,$ARGV[2]) } elsif ($#ARGV == -1) { $thetime = time } else { die 'usage: sepdate [month date year]' } $days = int (($thetime - &timelocal(0,0,0,31,7,93)) / (60 * 60 * 24)); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($thetime); printf ("%3s Sep %2d %2.2d:%2.2d:%2.2d %3s 1993\n", (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,strftime('%Z',localtime));