A date data-type (which is what I am assuming you are using) is aware of leap years. That is why date data-types or better for dates than just 8.0 numeric.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Schutte, Michael D
Sent: Wednesday, August 10, 2011 11:53 AM
To: RPG programming on the IBM i / System i
Subject: Subtracting 364 days from current date.
http://code.midrange.com/d6c4354ba1.html
I put a sample program at the link above. I was wondering if anyone could explain the situation to me? If you take today's date and subtract 364 days, you get a Wednesday of last year. That's great, that's what I want, however, you take 08/13/2008 and subtract 364 days you still get a Wednesday, 8/15/2011. My question is how is that possible when 2008 was a leap year and there's an extra day Febraury 29th, 2008.
Excel comes up with the same results. Don't get me wrong, I do want that Wednesday, I'd just like to know how it's working... I'm not seeing it.
Here's what excel came up with (same as what I get with RPGLE).
Wednesday, August 10, 2011
Wednesday, August 11, 2010
Subtract 364 From Previous
Wednesday, August 12, 2009
Subtract 364 From Previous
Wednesday, August 13, 2008
Subtract 364 From Previous
Wednesday, August 15, 2007
Subtract 364 From Previous
Wednesday, August 16, 2006
Subtract 364 From Previous
Wednesday, August 17, 2005
Subtract 364 From Previous
Wednesday, August 18, 2004
Subtract 364 From Previous
Wednesday, August 20, 2003
Subtract 364 From Previous
Wednesday, August 21, 2002
Subtract 364 From Previous
Wednesday, August 22, 2001
Subtract 364 From Previous
Wednesday, August 23, 2000
Subtract 364 From Previous
Wednesday, August 25, 1999
Subtract 364 From Previous
Wednesday, August 26, 1998
Subtract 364 From Previous
Wednesday, August 27, 1997
Subtract 364 From Previous
Wednesday, August 28, 1996
Subtract 364 From Previous
Wednesday, August 30, 1995
Subtract 364 From Previous
Thank you,
Michael Schutte
Join BE Mail now and receive a grocery coupon for a Buy One, Get One Free Side Dish in your Inbox! You can also look forward to exclusive monthly offers from Bob Evans as well as insider news about our restaurants, grocery food products, recipes, chefs and local community activities. For more information, visit www.bobevans.com/bemail<
http://www.bobevans.com/bemail>
________________________________
Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.