You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Radu Preotiuc-Pietro <ra...@bea.com> on 2006/10/14 02:56:35 UTC

Re: xmlbeans with hr-xml DateTime's

What's happening most likely is that you have defined the
"approvedDateTime" attribute in your Schema as having type "xs:date"
which means a date _without_ time. As a result, when you set your
calendar using approval.setApprovedDateTime() it only sets the date, and
it loses the time.
To fix it, simply change your attribute's type from "xs:date" to
"xs:dateTime".

Radu

On Wed, 2006-09-13 at 07:22 -0700, Craig Fordham wrote:
> Hi User,
> 
> I am using xmlbeans to compile my xml with includes mostly hr-xml with
> a few
> tags of my own. But i am having problems setting the DateTime fields
> in
> hr-xml. In java I convert a java.util.Date (with time) to a xmlbeans
> GDDate
> and then from that get the XMLCalendar object from that. code snippet
> and
> output:-
> 
> GDate approved = new GDate(time.getApproved());
>           logger.info("Millis from ts going into
> hrxml"+time.getApproved().getTime());
>           logger.info("Date  from ts going into
> hrxml"+time.getApproved());
>           logger.info("GDdate seconds going into
> hrxml"+approved.getSecond());
>           logger.info("Date GDdate going into hrxml"+approved);
>           logger.info("Calendar from GDdate going into
> hrxml"+approved.getCalendar());
>           approval.setApprovedDateTime(approved.getCalendar());
>           logger.info("Calendar from GDdate after
> setter"+approval.getApprovedDateTime());
>           logger.info("Calendar from GDdate after
> setter"+approval.getApprovedDateTime().getTimeInMillis());
> 
> logger output follows:-
> 
> Millis from ts going into hrxml1156329750000
> Date  from ts going into hrxml2006-08-23 11:42:30.0
> GDdate seconds going into hrxml30
> Date GDdate going into hrxml2006-08-23T11:42:30+01:00
> Calendar from GDdate going into hrxml2006-08-23T11:42:30+01:00
> Calendar from GDdate after setter2006-08-23+01:00
> Calendar from GDdate after setter1156287600000
> 
> Can you give me any pointers on why this may be and what i may be
> doing
> wrong?
> 
> Cheers
> Craig
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 
> 
_______________________________________________________________________
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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org