From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 21 14:01:55 2012 Received: (at submit) by debbugs.gnu.org; 21 Mar 2012 18:01:55 +0000 Received: from localhost ([127.0.0.1]:59974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SAPr6-0005nB-95 for submit@debbugs.gnu.org; Wed, 21 Mar 2012 14:01:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60451) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SAPmw-0005gJ-74 for submit@debbugs.gnu.org; Wed, 21 Mar 2012 13:57:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAPJ5-0007RG-3X for submit@debbugs.gnu.org; Wed, 21 Mar 2012 13:26:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAPJ4-0007R9-Tk for submit@debbugs.gnu.org; Wed, 21 Mar 2012 13:26:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAPIw-0003Cx-7m for bug-coreutils@gnu.org; Wed, 21 Mar 2012 13:26:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAPIn-0007Pu-Bx for bug-coreutils@gnu.org; Wed, 21 Mar 2012 13:26:33 -0400 Received: from txmx04.bankofamerica.com ([171.161.160.80]:58552 helo=txdmzmailmx04.bankofamerica.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAPIn-0007Pf-0K for bug-coreutils@gnu.org; Wed, 21 Mar 2012 13:26:25 -0400 Received: from txdmzmailmx05.bankofamerica.com ([171.180.168.230]) by txdmzmailmx04.bankofamerica.com (8.13.8/8.13.6) with ESMTP id q2LHQMCE023845 for ; Wed, 21 Mar 2012 17:26:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bankofamerica.com; s=corp1; t=1332350782; bh=S9iqTGXf1d+1YMOCtKOqWuWep7mcd7V6FGTCz5/z4GE=; h=Date:From:Subject:To:Message-id:MIME-version:Content-type; b=CVpjKM4569UtFl+j+25+RUpzvfzNk8TEJtVrDsYO8CGS1SN0L0bDk1UYQm+zN2DgC 6a7HN2W4AvBSvSOajm/qyY6oMXRP0ojdH8TWsSWot3XJOpUEJGwyi++5pb0CKt4IQ7 Qc3mobI64prco5Zt5o9K5U2OnFjCPFKEtDOsBqCM= Received: from memtx2mta03.bankofamerica.com (memtx2mta03.bankofamerica.com [171.186.232.156]) by txdmzmailmx05.bankofamerica.com (8.14.3/8.13.6) with ESMTP id q2LHQLfv011432 for ; Wed, 21 Mar 2012 17:26:21 GMT Date: Wed, 21 Mar 2012 13:26:19 -0400 From: "Morin, Rick" Subject: Having an issue with the date program To: "bug-coreutils@gnu.org" Message-id: <3657FB45EB09AA45A57F4546D16166061F2384C0@smtp_mail.bankofamerica.com> MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_nTIWGH07dTP/C/D8Rul/ww)" Content-language: en-US Accept-Language: en-US Thread-topic: Having an issue with the date program Thread-index: Ac0Hh7qAJYgzBW0oRdOOb7h/OZ+GtQ== X-MS-Has-Attach: X-MS-TNEF-Correlator: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.6.7498, 1.0.260, 0.0.0000 definitions=2012-03-21_06:2012-03-21, 2012-03-21, 1970-01-01 signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 21 Mar 2012 14:01:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) --Boundary_(ID_nTIWGH07dTP/C/D8Rul/ww) Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Hello, I'm having an interesting time trying to get the following code to work using your coreutils date program. I'm trying to get the date for Wednesday of the current week. This is running in a Korn shell on an AIX 5.3 (AIX 64) platform. MDOW1=$(${SBIN}/date +%w) let MDOW=$MDOW1-1 let WDOW=$MDOW-2 MONYYYYMMDD=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -$MDOW day" +%Y-%m-%d) MONMMDDYYYY=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -$MDOW day" +%m%d%Y) MONDAYDDMMMYYYY=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -$MDOW day" +%d%b%Y) WEDYYYYMMDD=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -($WDOW) day" +%Y%m%d) WEDMMDDYYYY=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -($WDOW) day" +%m%d%Y) WEDDAYDDMMMYYYY=$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -($WDOW) day" +%d%b%Y) The 3 MONxxx and 3 WEDxxx variables are all exported. I'm having trouble with the WED dates. On Monday and Tuesday, the WEDxxx variables correctly displayed Mar 21, 2012, in their various formats. But today on Wed, the 21st, they are displaying the Mar 22nd. WAP:/opt/freeware/bin> echo $MDOW1 $MDOW $WDOW 3 2 0 WAP:/opt/freeware/bin> echo $MONYYYYMMDD $MONMMDDYYYY $MONDAYDDMMMYYYY 2012-03-19 03192012 19Mar2012 WAP:/opt/freeware/bin> echo $WEDYYYYMMDD $WEDMMDDYYYY $WEDDAYDDMMMYYYY 20120322 03222012 22Mar2012 WAP:/opt/freeware/bin> Any assistance you can provide would be greatly appreciated. The target date is day 3 of the current week, with Monday being the 1. Just to clarify, on Sunday, I am looking for the previous Wednesday date. Thank you! Richard (Rick) Morin Bank of America VP, Market Information Mgr I GCSBB Marketing - Global Strategy & Marketing DIRECT RESPONSE / ANALYTICAL MARKETING 904.783.1727 FL8-054-01-01 Instant recognition is a very powerful motivator. Please recognize our associates by following the link below. Global Recognition Program ---------------------------------------------------------------------- This message w/attachments (message) is intended solely for the use of the intended recipient(s) and may contain information that is privileged, confidential or proprietary. If you are not an intended recipient, please notify the sender, and then please delete and destroy all copies and attachments, and be advised that any review or dissemination of, or the taking of any action in reliance on, the information contained in or attached to this message is prohibited. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept, monitor, review and retain e-communications (EC) traveling through its networks/systems and may produce any such EC to regulators, law enforcement, in litigation and as required by law. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or free of errors or viruses. References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you consent to the foregoing. --Boundary_(ID_nTIWGH07dTP/C/D8Rul/ww) Content-type: text/html; CHARSET=US-ASCII Content-transfer-encoding: quoted-printable

Hello,

 

I’= ;m having an interesting time trying to get the following code to work usin= g your coreutils date program.  I’m trying to get the date for W= ednesday of the current week.  This is running in a Korn shell on an A= IX 5.3 (AIX 64) platform.

 

MDOW1=3D$(${SBIN}/date +%w)

let MDOW=3D$MDOW1-1

let = WDOW=3D$MDOW-2

MONYYYYMMDD=3D$(${SBIN}/d= ate -d"${manYY}-${manMM}-${manDD} -$MDOW day" +%Y-%m-%d)

MONMMDDYYYY=3D$(${SBIN}/date -d"${manYY}-${= manMM}-${manDD} -$MDOW day" +%m%d%Y)

MONDAYDDMMMYYYY=3D$(${SBIN}/date -d"${manYY}-${manMM}-${manDD} -$MDO= W day" +%d%b%Y)

WEDYYYYMMDD=3D$(${S= BIN}/date -d"${manYY}-${manMM}-${manDD} -($WDOW) day" +%Y%m%d)

WEDMMDDYYYY=3D$(${SBIN}/date -d"${man= YY}-${manMM}-${manDD} -($WDOW) day" +%m%d%Y)

WEDDAYDDMMMYYYY=3D$(${SBIN}/date -d"${manYY}-${manMM}-${manD= D} -($WDOW) day" +%d%b%Y)

&nbs= p;

The 3 MONxxx and 3 WEDxxx variables are al= l exported.  I’m having trouble with the WED dates.  On Mon= day and Tuesday, the WEDxxx variables correctly displayed Mar 21, 2012, in = their various formats.  But today on Wed, the 21st, they ar= e displaying the Mar 22nd.

 

WAP:/opt/freeware/bin> echo $MDO= W1 $MDOW $WDOW          &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;         

3 2 0

WAP:/opt/freewar= e/bin> echo $MONYYYYMMDD $MONMMDDYYYY $MONDAYDDMMMYYYY   =             &nb= sp;            =             &nb= sp;            =             &nb= sp;            =      

2012-03-= 19 03192012 19Mar2012

WAP:/opt/freeware/= bin> echo $WEDYYYYMMDD $WEDMMDDYYYY $WEDDAYDDMMMYYYY    &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;    

20120322 0= 3222012 22Mar2012

WAP:/opt/freeware/bin&= gt;

 

Any assistance you can provide would be greatly appreciated.  Th= e target date is day 3 of the current week, with Monday being the 1.  = Just to clarify, on Sunday, I am looking for the previous Wednesday date.

 

Thank you!

 

R= ichard (Rick) Morin

Bank of America=

VP, Market Information Mgr I

GCSBB Marketing - Global Strategy & Marketing

DIRECT RESPONSE / ANALYTICAL MARKETING

904.783.1727

FL8-054-01-01

 

Instant r= ecognition is a very powerful motivator.

Please recognize our associates by following the link below.<= /span>

Global Recognition Pro= gram

 =


This message w/attachments (message) is intended solely for the use of = the intended recipient(s) and may contain information that is privileged, c= onfidential or proprietary. If you are not an intended recipient, please no= tify the sender, and then please delete and destroy all copies and attachme= nts, and be advised that any review or dissemination of, or the taking of a= ny action in reliance on, the information contained in or attached to this = message is prohibited.
Unless specifically indicated, this message is not an offer to sell or a so= licitation of any investment products or other financial product or service= , an official confirmation of any transaction, or an official statement of = Sender. Subject to applicable law, Sender may intercept, monitor, review an= d retain e-communications (EC) traveling through its networks/systems and m= ay produce any such EC to regulators, law enforcement, in litigation and as= required by law.
The laws of the country of each sender/recipient may impact the handling of= EC, and EC may be archived, supervised and produced in countries other tha= n the country in which you are located. This message cannot be guaranteed t= o be secure or free of errors or viruses.

References to "Sender" are references to any subsidiary of Bank o= f America Corporation. Securities and Insurance Products: * Are Not FDIC In= sured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit *= Are Not a Condition to Any Banking Service or Activity * Are Not Insured b= y Any Federal Government Agency. Attachments that are part of this EC may h= ave additional important disclosures and disclaimers, which you should read= . This message is subject to terms available at the following link:
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you = consent to the foregoing.
--Boundary_(ID_nTIWGH07dTP/C/D8Rul/ww)-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 21 15:27:17 2012 Received: (at control) by debbugs.gnu.org; 21 Mar 2012 19:27:17 +0000 Received: from localhost ([127.0.0.1]:60098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SARBk-0007xE-Jq for submit@debbugs.gnu.org; Wed, 21 Mar 2012 15:27:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24715) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SARBN-0007wM-SM; Wed, 21 Mar 2012 15:27:14 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2LIu4tL024520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Mar 2012 14:56:06 -0400 Received: from [10.3.113.134] (ovpn-113-134.phx2.redhat.com [10.3.113.134]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2LIAheG005255; Wed, 21 Mar 2012 14:10:43 -0400 Message-ID: <4F6A19A3.10506@redhat.com> Date: Wed, 21 Mar 2012 12:10:43 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: "Morin, Rick" Subject: Re: bug#11057: Having an issue with the date program References: <3657FB45EB09AA45A57F4546D16166061F2384C0@smtp_mail.bankofamerica.com> In-Reply-To: <3657FB45EB09AA45A57F4546D16166061F2384C0@smtp_mail.bankofamerica.com> X-Enigmail-Version: 1.4 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE1BF7536BD8C300BDC947482" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control Cc: 11057-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE1BF7536BD8C300BDC947482 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable tag 11057 notabug thanks On 03/21/2012 11:26 AM, Morin, Rick wrote: > Hello, >=20 > I'm having an interesting time trying to get the following code to work= using your coreutils date program. I'm trying to get the date for Wedne= sday of the current week. This is running in a Korn shell on an AIX 5.3 = (AIX 64) platform. >=20 > MDOW1=3D$(${SBIN}/date +%w) Why are you basing things on %w (0-6, 1 is Monday), when you could instead be using %u (1-7, 1 is Monday)? Your script snippet didn't show what $manYY and friends were set to, but I suspect you were manually setting things to various dates to see how your script behaved. >=20 > Any assistance you can provide would be greatly appreciated. The targe= t date is day 3 of the current week, with Monday being the 1. Just to cl= arify, on Sunday, I am looking for the previous Wednesday date. If I understand what you are asking, you want: On Sunday, generate the date of the prior Wednesday (previous week). On Monday-Tuesday, generate the date of the next Wednesday (current week)= =2E On Wednesday, generate the current date. On Thursday-Saturday, generate the date of the prior Wednesday (current week). More concretely, it sounds like using March 1-7, 2012 as our sample inputs, you want the following outputs: Mar 1 (Thu) =3D> Feb 29 Mar 2 (Fri) =3D> Feb 29 Mar 3 (Sat) =3D> Feb 29 Mar 4 (Sun) =3D> Feb 29 Mar 5 (Mon) =3D> Mar 7 Mar 6 (Tue) =3D> Mar 7 Mar 7 (Wed) =3D> Mar 7 Also, you should remember that when adding or subtracting days, you must take into account daylight savings transitions. I'd recommend basing your computations off of noon, rather than midnight, so that even if you end up at 11am or 1pm due to your calculations changing by multiples of 24 hours but crossing a day with 23 or 25 hours, you still get the right date. $ for i in `seq 7`; do offset=3D$(date -d"Mar $i, 2012" +%u) date -d"12pm Mar $i, 2012 +3 days -$offset day" done Wed Feb 29 12:00:00 MST 2012 Wed Feb 29 12:00:00 MST 2012 Wed Feb 29 12:00:00 MST 2012 Wed Feb 29 12:00:00 MST 2012 Wed Mar 7 12:00:00 MST 2012 Wed Mar 7 12:00:00 MST 2012 Wed Mar 7 12:00:00 MST 2012 Since it looks like I can generate what you asked for, I'm closing this as not a bug. You can continue to ask further questions on this thread, but I don't see anything broken in the current coreutils implementation. > This message w/attachments (message) is intended solely for the use of = the intended recipient(s) Disclaimers like this are unenforceable on publicly-archived lists. It is considered better netiquette to send from a personal account, rather than an employer's account. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigE1BF7536BD8C300BDC947482 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPahmjAAoJEKeha0olJ0NqNnYH/ikcnVRa9bCsxcCn04T75YpA AaFN67s9vNBQS/2c5gisU8g0CDBqylsTdAY7RQe0EoVMFCcjHlSpwA/hQwHLjWCU ClhLMCPHLyrF5N4aHAvPpfmn318GP8oFBerj4f6XiWql3Hc0+4JI/bvC5zktpBdT uOxbebVJ1kYt8W7yvKrKgu7YaJB6cxh1n8Ytnbm6ZgfAY6uH/dS11MJzpfkoBIxa BThqt6O/2Un18A3MM+muOhf+a4eTUFg9O1rSFed243mY4wgUg6IwuQw84cZfpEzC Fb49rb9FXRYPX2L3v8uuTnv3w4drtgGp2XJD0w/KaJOg0gGc+Px404W6ZJIxWD8= =kZT1 -----END PGP SIGNATURE----- --------------enigE1BF7536BD8C300BDC947482-- From unknown Thu Aug 21 14:54:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 19 Apr 2012 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator