[Linux-disciples] Dates backwards
Adam Rosi-Kessel
adam at rosi-kessel.org
Wed Feb 8 16:38:26 EST 2006
Stephen R Laniel wrote:
> There's a nice feature of date(1) under FreeBSD: you can
> type things like 'date -v-1w' to display a date one week
> before the present date. It doesn't look like date(1) under
> Debian or Gentoo has caught up yet. What would you guys use
> if you needed to stick "one week ago today" into a shell
> script?
# cat datecalc
#!/usr/bin/perl
use Date::Manip;
my $start_date = shift @ARGV;
my $interval = shift @ARGV;
unless ($start_date) {
print "Enter start date: ";
$start_date = <STDIN>;
}
unless ($interval) {
print "Enter interval: ";
$interval = <STDIN>;
}
if ($start_date && $interval) {
print UnixDate(DateCalc($start_date,$interval),"%F") . "\n";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060208/c9313eed/signature.pgp
More information about the Linux-disciples
mailing list