Link to home
Start Free TrialLog in
Avatar of cgray1223
cgray1223

asked on

How do I get the XMLGregorianCalendar current time GMT?

Hello,

How do I get the current datetime using XMLGregorianCalendar in GMT format?  I've tried the below method but that returns it based on my computers time I believe.  

 private XMLGregorianCalendar getCurrentDateTime(){
        GregorianCalendar gc = new GregorianCalendar();
        DatatypeFactory dtf=null;
        try {
            dtf = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException ex) {
            Logger.getLogger(SyncServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return dtf.newXMLGregorianCalendar(gc);
    }

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tripplebeam
Tripplebeam

try this page for info:
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/XMLGregorianCalendar.html
<a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/XMLGregorianCalendar.html>TRY THIS</a>

Open in new window

Avatar of cgray1223

ASKER

Thanks for the help, why do I get a Z at the end?

2010-04-07T16:44:51.000Z