Date: Wed, 17 Dec 1997 22:09:49 -0500 (EST) From: "Joe \"Marcus\" Clarke" <jmcla@ocala.cs.miami.edu> To: Brian Clapper <bmc@WillsCreek.COM> Cc: questions@freebsd.org Subject: Re: Y2K Message-ID: <Pine.SGI.3.96.971217220837.25860A-100000@ocala.cs.miami.edu> In-Reply-To: <199712180257.VAA00472@current.willscreek.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the note. I didn't know that was the case. I guess I was looking for something more lik Digital UNIX where you did date like [[cc]yy]mmddHHMM[.ss]. But, hey, if it works, I'll take it. Joe Clarke On Wed, 17 Dec 1997, Brian Clapper wrote: > 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?Pine.SGI.3.96.971217220837.25860A-100000>
