bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11057: Having an issue with the date program


From: Morin, Rick
Subject: bug#11057: Having an issue with the date program
Date: Wed, 21 Mar 2012 13:26:19 -0400

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<http://flagscape.bankofamerica.com/portal/site/flagscape/menuitem.fae9b47594eab28f211649ede3cc5cba/?vgnextoid=c890a845526a4210VgnVCM10000038ccc5abRCRD&vgnextfmt=default&mname=flagscape_e9cec66651923210VgnVCM2000003cccc5abRCRD_876818063>

----------------------------------------------------------------------
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]