From owner-freebsd-current@FreeBSD.ORG Wed Sep 8 12:30:33 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 96DB916A4CE for ; Wed, 8 Sep 2004 12:30:33 +0000 (GMT) Received: from speicher.org (speicher.org [208.199.76.238]) by mx1.FreeBSD.org (Postfix) with ESMTP id C8F6043D41 for ; Wed, 8 Sep 2004 12:30:32 +0000 (GMT) (envelope-from geoff@speicher.org) Received: from speicher.org (localhost [127.0.0.1]) by speicher.org (8.12.11/8.12.11) with ESMTP id i88CUULl075659; Wed, 8 Sep 2004 08:30:30 -0400 (EDT) (envelope-from geoff@speicher.org) Received: (from geoff@localhost) by speicher.org (8.12.11/8.12.11/Submit) id i88CUT5M075658; Wed, 8 Sep 2004 08:30:29 -0400 (EDT) (envelope-from geoff) Date: Wed, 8 Sep 2004 08:30:29 -0400 From: Geoff Speicher To: Poul-Henning Kamp Message-ID: <20040908123029.GA74545@sirius.speicher.org> References: <38933.1094640660@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <38933.1094640660@critter.freebsd.dk> User-Agent: Mutt/1.4.2.1i cc: current@freebsd.org Subject: Re: Idea for date(1) improvement. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2004 12:30:33 -0000 On Wed, Sep 08, 2004 at 12:51:00PM +0200, Poul-Henning Kamp wrote: > > I have sometimes needed to get the date of yesterday or last monday > and so on for creating filenames. > > We have this very flexible code in at(1) and cvs(1) for specifying > time. > Anyone up for making it possible to say: > > date -w "2 days ago" FWIW, there's a public-domain implementation that PHP uses for its strtotime() function (http://php.net/strtotime), and it appears to do all/most of what /usr/src/usr.bin/at/parsetime.c does, plus more (time zones, for example). http://cvs.php.net/co.php/php-src/ext/standard/parsedate.y?r=1.56 Geoff