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.newInstanc e();
} catch (DatatypeConfigurationExce ption ex) {
Logger.getLogger(SyncServi ceImpl.cla ss.getName ()).log(Le vel.SEVERE , null, ex);
}
return dtf.newXMLGregorianCalenda r(gc);
}
Thanks!
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.newInstanc
} catch (DatatypeConfigurationExce
Logger.getLogger(SyncServi
}
return dtf.newXMLGregorianCalenda
}
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help, why do I get a Z at the end?
2010-04-07T16:44:51.000Z
2010-04-07T16:44:51.000Z
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/XMLGregorianCalendar.html
Open in new window