× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ok the easiest way to fix this would be for IBM to provide a new bif
%monthend().... 


Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Simon Coulter
Sent: Monday, March 27, 2006 6:29 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Bug in IBM Date Routies %month


On 28/03/2006, at 9:54 AM, Simon Coulter wrote:

> And look closely at the printed dates. Why are the second and third
the
> same date? Why does adding 1 month to 2006-01-31 not give 2006-02-28?
> Easy to explain once you understand what is happening but I'd rather
> have RPG's behaviour than Java's.

The last example used the Date class. Here is one using the Calendar 
class:

import java.util.*;
public class PraveenCalendar
{
   public static void main(String[] args)
   {
     GregorianCalendar gc = new GregorianCalendar(2006, 0, 31); // 
Java's inconsistent counting practices
     System.out.println(gc.getTime());
     gc.add(Calendar.MONTH, 1);
     System.out.println(gc.getTime());
     gc.add(Calendar.MONTH, 1);
     System.out.println(gc.getTime());
     gc.add(Calendar.MONTH, 1);
     System.out.println(gc.getTime());
     gc.add(Calendar.MONTH, 1);
     System.out.println(gc.getTime());
   }
}                                                                       
                                 
  > java PraveenCalendar
    Tue Jan 31 00:00:00 GMT 2006
    Tue Feb 28 00:00:00 GMT 2006
    Tue Mar 28 00:00:00 GMT 2006
    Fri Apr 28 00:00:00 GMT 2006
    Sun May 28 00:00:00 GMT 2006 

Hmm ... looks just like the results I'd expect from RPG IV!

Regards,
Simon Coulter.
--------------------------------------------------------------------
    FlyByNight Software         AS/400 Technical Specialists

    http://www.flybynight.com.au/
    Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
    Fax:   +61 3 9419 0175                                   \ /
                                                              X
                  ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.