W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2011

Fwd: org.w3c.util.DateParser milliseconds.

From: RaúlEdoP <apuredol@gmail.com>
Date: Thu, 27 Jan 2011 19:52:03 +0000
Message-Id: <19018028-C051-4417-AC32-D21A3F26F6CB@gmail.com>
To: "www-jigsaw@w3.org" <www-jigsaw@w3.org>
> 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:38 GMT