Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Jan 2000 23:53:49 +0700
From:      Eugene Grosbein <eugen@iname.com>
To:        hgoldste@bbs.mpcs.com
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: date +%G still thinks it's 1999?
Message-ID:  <386E311D.6E04DC54@iname.com>
References:  <14446.11440.328151.913890@penny.n2wx.ampr.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Howard Goldstein wrote:
> 
> I'm not sure what I'm doing wrong here :(
> 
> cally:/usr/src/bin/date$ date -u
> Sat Jan  1 16:22:45 GMT 2000
> cally:/usr/src/bin/date$ date -u '+%a, %d %b %G %H:%M:%S GMT'
> Sat, 01 Jan 1999 16:23:01 GMT
> cally:/usr/src/bin/date$ date -u '+%G'
> 1999

It's all right. From 'man strftime':
-----
%G    is replaced by a year as a decimal number with century.  This year
      is the one that contains the greater part of the week (Monday as
      the first day of the week).

%g    is replaced by the same year as in ``%G'', but as a decimal number
      without century (00-99).
-----
You should use %Y to obtain 2000.

Eugene Grosbein.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?386E311D.6E04DC54>