Date: Wed, 17 Dec 1997 21:57:01 -0500 (EST) From: Brian Clapper <bmc@WillsCreek.COM> To: "Joe \"Marcus\" Clarke" <jmcla@ocala.cs.miami.edu> Cc: questions@freebsd.org Subject: Re: Y2K Message-ID: <199712180257.VAA00472@current.willscreek.com> In-Reply-To: <Pine.SGI.3.96.971217040100.18590A-100000@ocala.cs.miami.edu> References: <Pine.SGI.3.96.971217040100.18590A-100000@ocala.cs.miami.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Joe "Marcus" Clarke wrote: > Hey, I know that most unices will be Y2K compatible. They use time_t to > keep time, blah, blah.... But my question is the `date` command. Date > will only let you set the date with a 2-digit year. How will date > handle 00? Will it know to make it 2000, or will it use .....I just > tried it....it DOES make the date 2000. That answers my question. Hats > off, again, to the team at FreeBSD. You guys think of everything. I know you've satisfied yourself that things are okay, but I need to point out an incorrect comment in your message (if only to satisfy the pedant in me). date(1) will, in fact, permit you to specify a 4-digit date. I quote from the 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). strptime(3) is to strftime(3) as scanf(3) is to printf(3): That is, strptime() will parse a date string using the '%' escapes recognized by strftime(). (If I recall, strptime() is an X/Open-specified routine.) For example: (current) ~ > sudo date -f '%Y' 2001 Password: Mon Dec 17 21:54:48 EST 2001 (current) ~ > cal 12 2001 December 2001 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (current) ~ > sudo date -f '%Y' 1997 Password: Wed Dec 17 21:54:55 EST 1997 ----- Brian Clapper, bmc@WillsCreek.COM, http://WWW.WillsCreek.COM/ It is not true that life is one damn thing after another -- it's one damn thing over and over. -- Edna St. Vincent Millay
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712180257.VAA00472>