-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.ttzero.excel.util.DateUtil.toDate(double d)转换算法是秒级的,会出现比实际少一秒的情况 #232
Labels
Comments
感谢你的反馈!暂时还没有找出原因,猜想是double精度引起。 临时的可以从row中获取double值然后再使用poi的静态方法转时间。
|
把秒级的转换成毫秒级,加上0.5 |
欢迎提交PR贡献你的代码!!! 步骤:
|
感觉加0.5不安全,加0.5应该会出现多1秒的情况? |
看POI的算法是毫秒级别加了0.5 |
可以先提一个PR,我有空验证一下。3Q! |
wangguanquan
pushed a commit
that referenced
this issue
Mar 6, 2022
wangguanquan
pushed a commit
that referenced
this issue
May 1, 2022
wangguanquan
pushed a commit
that referenced
this issue
Mar 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
double v=44248.466099537;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(v);
Date d1= org.ttzero.excel.util.DateUtil.toDate(v);
String dStr = sdf.format(d);
String d1Str=sdf.format(d1);
System.out.println(String.format("dStr=%s",dStr));
System.out.println(String.format("d1Str=%s",d1Str));
The text was updated successfully, but these errors were encountered: