ASF Bugzilla – Attachment 29965 Details for
Bug 54579
ExcelStyleDateFormatter("s.000") misformats milliseconds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
JUnit test case for ExcelStyleDateFormatter
ExcelStyleDateFormatterTest.java (text/java), 1.45 KB, created by
Greg B
on 2013-02-18 22:58:18 UTC
(
hide
)
Description:
JUnit test case for ExcelStyleDateFormatter
Filename:
MIME Type:
Creator:
Greg B
Created:
2013-02-18 22:58:18 UTC
Size:
1.45 KB
patch
obsolete
>package org.apache.poi.ss.usermodel; > >import java.text.DateFormat; >import java.util.Date; > >import org.junit.Test; > >public class ExcelStyleDateFormatterTest { > > @Test > public void testExcelStyleDateFormatterString() { > // This formatter outputs milliseconds incorrectly: > DateFormat formatter1 = new ExcelStyleDateFormatter("s.000"); > > System.out.println("1 -> " + formatter1.format(new Date(1L))); > // 1 -> 00.1 XXX Wrong! > > System.out.println("10 -> " + formatter1.format(new Date(10L))); > // 10 -> 00.10 XXX Wrong! > > System.out.println("100 -> " + formatter1.format(new Date(100L))); > // 00.100 CORRECT > > System.out.println("1000 -> " + formatter1.format(new Date(1000L))); > // 01.0 CORRECT > > System.out.println("10000 -> " + formatter1.format(new Date(10000L))); > // 10.0 CORRECT > > System.out.println(); > > > // This formatter outputs milliseconds correctly: > DateFormat formatter2 = new ExcelStyleDateFormatter("s.SSS"); > > System.out.println("1 -> " + formatter2.format(new Date(1L))); > // 1 -> 00.001 CORRECT > > System.out.println("10 -> " + formatter2.format(new Date(10L))); > // 10 -> 00.010 CORRECT > > System.out.println("100 -> " + formatter2.format(new Date(100L))); > // 00.100 CORRECT > > System.out.println("1000 -> " + formatter2.format(new Date(1000L))); > // 01.000 CORRECT > > System.out.println("10000 -> " + formatter2.format(new Date(10000L))); > // 10.000 CORRECT > > > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 54579
: 29965