Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 1998 09:00:19 -0500 (EST)
From:      Brian Clapper <bmc@WillsCreek.COM>
To:        Greg Lehey <grog@lemis.com>
Cc:        Shawn Ramsey <shawn@luke.cpl.net>, questions@freebsd.org
Subject:   Re: time?
Message-ID:  <199801051400.JAA12801@current.willscreek.com>
In-Reply-To: <19980105194716.40370@lemis.com>
References:  <Pine.BSF.3.95.980105020251.1369A-100000@luke.cpl.net> <19980105194716.40370@lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 January, 1998, at 19:47 (+1030)
Greg Lehey <grog@lemis.com> wrote:

> Sorry, you can't (currently) specify all four digits of the year.
> That's not that serious: for example, to set the year to 2002, you can
> enter:
>
>  # date 0201071514

Actually, there *is* a way to specify all four digits of the year, but it's
counterintuitive (and not found on all UNIX date(1) commands).  From the
FreeBSD date(1) man page:

     -f      Use fmt as the format string to parse the date provided rather
             than using the default [[[[yy]mm]dd]HH]MM[.ss] format.  Parsing
             is done using strptime(3).

The command

        # date -f '%Y/%m/%d %H:%M:%S' '1998/01/05 10:00:03'

will set the date to 05 Jan, 1998 10:00:03 AM.
-----
Brian Clapper, bmc@WillsCreek.COM, http://WWW.WillsCreek.COM/
When you make your mark in the world, watch out for guys with erasers.
        -- The Wall Street Journal



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801051400.JAA12801>