[H-GEN] Playing with date(1)

Anthony Towns aj at azure.humbug.org.au
Sat Jan 9 01:38:33 EST 1999


On Fri, Jan 08, 1999 at 08:54:12AM +1000, Jason Henry Parker wrote:
> [0]henry at freezer:~ $ date --date='saturday'
> Sat Jan  9 00:00:00 EST 1999
> [0]henry at freezer:~ $ date +%U --date='saturday'
> 01
> 
> Next saturday is week 1.  Fine.  (+%U starts counting from 0 after the
> first Sunday in a year.)  ("man date" for a the supporting documentation.)
> 
> [0]henry at freezer:~ $ date --date='31 dec'
> Fri Dec 31 00:00:00 EST 1999
> [0]henry at freezer:~ $ date +%U --date='31 dec'
> 52
> 
> 31st December is in week 52.  The day after Friday is Saturday, and it
> will be "week 53" of 1999.

Erm. Why would the day after Friday be in a different week? The day
after Thursday isn't. In particular, it should be in the *same* week,
which would make it still in the 52nd week of 1999 (even though it's also
the zeroth week of 2000 -- in fact, I think you can generalise that the
days in the 52nd week of year N can equally well be considered to be in
the 0th week of year N+1).

Another way of looking at it is to compare Fridays: 

[aj at sapphire ~]$ date +%U --date='8 jan'
01
[aj at sapphire ~]$ date +%U --date='31 dec'
52

And in any case, our last booked meeting for 1999 is Dec 11, so the point
is moot. :)

OTOH, I'm sure we could arrange a pleasant social evening for that night
(computers with Y2K bugs *not* invited)...

Cheers,
aj

-- 
Anthony Towns <aj at humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

``Like the ski resort of girls looking for husbands and husbands looking
  for girls, the situation is not as symmetrical as it might seem.''
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 434 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/19990109/77ae4bda/attachment.sig>


More information about the General mailing list