If you don't set the year explicitly, XMLBeans assumes year 0 for the
purposes of calculating getTime(). I don't know exactly why you get Jan
03 rather than Jan 01, I think it's because the Java<->XML Calendar
difference (in Java Julian calendar is used for dates earlier than 1582
I think, in XMLSchema Gregorian calendar is used all the time).

The main idea is: if you care about the date, set the date. If you only
care about the time of day, that's fine, but don't call getTime() then.

Radu

On Sat, 2006-10-07 at 15:17 -0700, T. H. Lin wrote:
> halloe dev.
> 
> I have not read the source code from XMLBeans.
> 
> I try to do this...
> XmlCalendar cc = new XmlCalendar("01:30:01");
> System.out.println(cc.isSet(Calendar.YEAR));
> System.out.println(cc.isSet(Calendar.MONTH));
> System.out.println(cc.isSet(Calendar.DAY_OF_MONTH));
> System.out.println(cc.isSet(Calendar.HOUR_OF_DAY));
> System.out.println(cc.isSet(Calendar.MINUTE));
> System.out.println(cc.isSet(Calendar.SECOND));
> System.out.println(cc.getTime().toString());
> 
> I got...
> false
> false
> false
> true
> true
> true
> Sat Jan 03 01:30:01 CET 0001
> 
> how does XMLBeans handle this only hh:mm:ss in constructor?
> and why I got here Jan 03 !?
> I don't understnd.
> 
> When I call new XmlCalendar("01:30:01"),
> I would like to have "today" on 01:30:01.
> isn't it trivial?
> 
> if it is intentional, how can I let it automatic set unset field to
> "today"?
> 
> here is the document
> ===================================
> XmlCalendar
> 
> public XmlCalendar(String xmlSchemaDateString)
> 
>     Constructs an XmlCalendar for a standard XML schema formatted date
> string. The parser accepts any of the following formats:
> YYYY-MM-DDThh:mm:ss - dateTime YYYY-MM-DD - date hh:mm:ss - time YYYY
> - gYear --MM - gMonth ---DD - gDay The parser actually accepts all 16
> combinations of subsets of fields (Y, M, D, T) using the same scheme,
> even for combinations that are not defined as types in the schema
> spec, such as year, day, and time: YYYY--DDThh:mm:ss - [everything but
> month specified] In the string, each field must be padded to its full
> width, for example, January must be --01, not just --1. In particular,
> a year must be padded to at least four digits, so "98" is not a valid
> year, although "1998" and "0098" are both valid years, unambiguously
> 19 centuries separated from each other. A year may also be preceded by
> a minus symbol: 0000 is 1 BC and -0001 is 2 BC. Finally a timezone is
> always allowed (yet optional) at the end. Timezones must be either "Z"
> (UTC, which we translate to GMT), or simple offsets from UTC in the
> range "-14:00" to "+14:00", for example: "14:30:00-05:00" specifies
> 2:30 PM in the afternoon at UTC-05:00, which is the same as EST. If a
> timezone is not specified, the default TimeZone is used.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to