X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 4 Jan 2010 13:54:31 -0500 Message-ID: Subject: Re: Incorrect year in date function. From: "Mark J. Reed" To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mon, Jan 4, 2010 at 1:40 PM, Jacob Jacobson wrote: > I am curious as to why this happened. > > I was at work yesterday and created a file. The name of the file > is created using the Cygwin date function. > > REV=$(date +rev-%b-%d-%g) > APPNAME="$1-$REV.img" %g (and the four-digit version %G) is the year according to the ISO week-number calendar; each such year is always a whole number of weeks (364 or 371 days), starting on a Monday and ending on a Sunday. Specifically, the first week is always the one containing January 4th; as such, today is 2010W1-1, the first day of the ISO year, and yesterday was 2009W53-7, the last day of the previous ISO year. So you got what you asked for, even if that wasn't what you actually wanted. :) If you want the CE year according to the standard Gregorian calendar, use %y (2-digit) or %Y (4-digit). -- Mark J. Reed -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple