Fwd: org.w3c.util.DateParser milliseconds.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: org.w3c.util.DateParser milliseconds.

apuredol

Hi, I am wondering why you do this

 

198:        buffer.append(twoDigit(calendar.get(Calendar.MILLISECOND)/10));

 

Is not the ISO 8601 format like: “yyyy-mm-ddTHH:MM:SS.SSS” ? 3 digits for milliseconds.

 

I realized because I was doing some tests, and sometimes went wrong:

 

    @Test

    public void testComparision() throws Exception {

        Date date = new Date();

        String isoDate = getIsoDate(date);

        Date date2 = parse(isoDate);

        String isoDate2 = getIsoDate(date2);

        assertEquals(date, date2);

        assertEquals(isoDate, isoDate2);

 

    }

 

I changed 198 line for:

buffer.append(StringUtils.threeDigit(calendar.get(Calendar.MILLISECOND)));

     

And now it always works.

 

Is there any reason to only considering two digits?

 

Thanks in advance,


Raúl Plata