Well, Date.getHours() is deprecated. If you create a new Calendar from
the Date instance, it is still correct...
import java.util.*;
public class timeTest
{
public static void main(String[] args)
{
Calendar time = Calendar.getInstance();
System.out.println("HOURS: " + time.get(Calendar.HOUR));
Date d = time.getTime();
System.out.println("DATE: " + d);
time.setTime(d);
System.out.println("HOURS: " + time.get(Calendar.HOUR));
/**
* Results
HOURS: 9
DATE: Tue Aug 26 09:49:59 PDT 2003
HOURS: 9
*/
}
}
-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Tuesday, August 26, 2003 9:32 AM
To: users_at_jaxb.dev.java.net
Wait, is this really a problem of JAXB or is this a problem of
java.util.Date?
I run a similar code. When I did:
Calendar start = schedule.getStart();
print( start.get(Calendar.HOUR_OF_DAY) );
I correctly get 13, but when I did:
Calendar start = schedule.getStart();
Date time = start.getTime();
print( time.getHours() );
I got 14. Note that when I change the time instant to
1999-05-31T12:34:56.052+09:00, those two values are wildly different (12
and 20)
regards,
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net