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



Hi Joe,

This was exactly it.
Thanks a lot!
Our forum is THE BEST!, no THE BESTEST...

Alex Pinsky
Intranet developer
Aeropostale, Inc.

-----Original Message-----
From: Joe Sam Shirah [mailto:jshirah@xxxxxxxxxxxxx]
Sent: Wednesday, March 24, 2004 12:53 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: problem with 04/04/2004 GregorianCalendar date



    Hi Alex,

    I don't have time at the moment to try out your code, but I suspect,
given the dates involved, that it has to do with the Daylight Savings Time
change.  In the US, it starts at 2 a.m. on April 4, 2004.  Try setting the
time to something after 1 in the morning.


                                                  Joe Sam

Joe Sam Shirah -        http://www.conceptgo.com
conceptGO         -        Consulting/Development/Outsourcing
Java Filter Forum:       http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?    http://www.jguru.com/faq/I18N
Que Java400?             http://www.jguru.com/faq/Java400



----- Original Message -----
From: "Alex Pinsky" <apinsky@xxxxxxxxxxxxxxx>
To: "Java AS/400 forum (E-mail)" <java400-l@xxxxxxxxxxxx>
Sent: Wednesday, March 24, 2004 12:07 PM
Subject: problem with 04/04/2004 GregorianCalendar date


> Hi all,
> I came across very strange problem when roll method in GregorianCalendar.
> When rolling down from given date - calendar skips 04/04/2004 and rolls to
the 04/03/2004
> When I roll up - dates are correct.
> Here is the code that I use, please test...
>
>     try {
>       SimpleDateFormat mmddyyyy = new SimpleDateFormat("MM/dd/yyyy");
>       SimpleDateFormat wd = new SimpleDateFormat("E");
>
>       String[] weekdates = new String[7];
>       String[] weekdays = new String[7];
>
>       GregorianCalendar cal = new GregorianCalendar();
>       java.util.Date date = mmddyyyy.parse("04/09/2004");
>
>       cal.setTime(date);
>
>       for (int i=0; i<weekdates.length; i++) {
>         cal.roll(Calendar.DAY_OF_YEAR, false);
>         date = cal.getTime();
>         weekdays[i] = wd.format(date);
>         weekdates[i] = mmddyyyy.format(date);
>       }
>       // print result
>       System.out.println("Result of rolling down");
>       for (int i=0; i<weekdates.length; i++) {
>         System.out.println(weekdays[i]+"; "+weekdates[i]);
>       }
>
>       // start rollup
>       date = mmddyyyy.parse("04/02/2004");
>
>       cal.setTime(date);
>
>       for (int i=0; i<weekdates.length; i++) {
>         cal.roll(Calendar.DAY_OF_YEAR, true);
>         date = cal.getTime();
>         weekdays[i] = wd.format(date);
>         weekdates[i] = mmddyyyy.format(date);
>       }
>       // print result
>       System.out.println("Result of rolling up");
>       for (int i=0; i<weekdates.length; i++) {
>         System.out.println(weekdays[i]+"; "+weekdates[i]);
>       }
>
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>
> // my print output: please not that there is no Sunday when roll down
used!!!!
> Result of rolling down
> Thu; 04/08/2004
> Wed; 04/07/2004
> Tue; 04/06/2004
> Mon; 04/05/2004
> Sat; 04/03/2004
> Fri; 04/02/2004
> Thu; 04/01/2004
>
> Result of rolling up
> Sat; 04/03/2004
> Sun; 04/04/2004
> Mon; 04/05/2004
> Tue; 04/06/2004
> Wed; 04/07/2004
> Thu; 04/08/2004
> Fri; 04/09/2004
>


_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.