Unknown XMLGregorianCalendar output


Hello,

I'm using the below to get the current datetime using XMLGregorianCalendar in GMT format, but I get 2010-04-07T16:44:51.000Z.  I'm unsure what the "Z" is at the end.  The rest looks correct.

 private XMLGregorianCalendar getCurrentDateTime(){
        GregorianCalendar gc = new GregorianCalendar();
         gc.setTimeZone(TimeZone.getTimeZone("GMT"));
        DatatypeFactory dtf=null;
        try {
            dtf = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException ex) {
            Logger.getLogger(SyncServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return dtf.newXMLGregorianCalendar(gc);
    }
cgray1223Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
VenabiliConnect With a Mentor Commented:
Extending XMLGregorianCalendar  and using the new class (and taking care of it there) is the only fast way I can think of.

http://www.coderanch.com/t/224752/Web-Services/java/Jaxb-display-instead-Z-timezone shows an example for it.
0
 
VenabiliCommented:
This Z stays for RFC 822 style timezone (-0400 for example) when SimpleDateFormat is used so I suspect it is what it stays for here as well.

Why it does not get expanded is not something I can answer without seeing some more code...
0
 
VenabiliCommented:
What JDK do you use?
Because there used to be a bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5064587 so if you use an oldish one, this might be the explanation...
0
 
cgray1223Author Commented:
Hi Venabili,

i'm using 1.5....can you think of any way to format it to remove it?
0
All Courses

From novice to tech pro — start learning today.