public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/18088] New: Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field.
@ 2004-10-20 19:01 mnefedov at rogers dot com
  2004-10-20 19:05 ` [Bug libgcj/18088] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: mnefedov at rogers dot com @ 2004-10-20 19:01 UTC (permalink / raw)
  To: java-prs

Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field -- it 
should not be adjusted.

Here is a sample code.

import java.util.Calendar;
import java.text.SimpleDateFormat;

public class CalendarTest2 {
	public static void main( String [] args ) {
		
		boolean fail = false;
		Calendar c = Calendar.getInstance();
		SimpleDateFormat df = new SimpleDateFormat( "EEEEEEEEEEEEE, 
yyyy-MM-dd [DDD] HH:mm:ss.SSSS" );
		
		System.out.println( "Today: " + df.format( c.getTime() ) );

		c.set( 2004, 9, 1, 12, 0, 0 );
		c.set( Calendar.MILLISECOND, 0 );
		System.out.println( df.format( c.getTime() ) );
		
		c.set( Calendar.DAY_OF_MONTH, 2 );
		System.out.println( df.format( c.getTime() ) );		
		
		c.set( Calendar.DAY_OF_MONTH, 3 );
		System.out.println( df.format( c.getTime() ) );		
		
		
		c.set( Calendar.DAY_OF_MONTH, 4 );
		System.out.println( df.format( c.getTime() ) );	
	}
}

Here is the output with the errors:
1: Today: Wednesday, 2004-10-20 [294] 13:51:47.0592
2: Friday, 2004-10-01 [275] 13:00:00.0000
3: Saturday, 2004-10-02 [276] 13:00:00.0000
4: Sunday, 2004-10-03 [277] 12:00:00.0000
5: Monday, 2004-10-04 [278] 12:00:00.0000

Error #1: line 2:  hour was set to 12 not 13. What is interesting in this 
case -- c.get( Calendar.HOUR ) will give 12 back. SimpleDateFormat() report 13 
though.

Error #2: line 4: hour is 12 now.

-- 
           Summary: Calendar's HOUR field gets adjusted when setting
                    DAY_OF_MONTH field.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mnefedov at rogers dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18088


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libgcj/18088] Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field.
  2004-10-20 19:01 [Bug libgcj/18088] New: Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field mnefedov at rogers dot com
@ 2004-10-20 19:05 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-20 19:05 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-20 19:05 -------


*** This bug has been marked as a duplicate of 18087 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18088


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-20 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-20 19:01 [Bug libgcj/18088] New: Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field mnefedov at rogers dot com
2004-10-20 19:05 ` [Bug libgcj/18088] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).