Fwd: org.w3c.util.DateParser milliseconds.

> 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

Received on Thursday, 27 January 2011 21:15:23 UTC