【发布时间】:2016-05-23 15:25:04
【问题描述】:
我在 Scala 中使用 java.text.SimpleDateFormat 将字符串转换为日期。
val isdf = new SimpleDateFormat("dd/MM/yyyy")
isdf.parse("01/22/2016") gives Sun Oct 01 00:00:00 UTC 2017
如何解决这个问题?有其他选择吗?
【问题讨论】:
-
您是在问为什么解析 22 月份不会导致错误?像这样? stackoverflow.com/questions/6899019/…
-
2016 年第 22 个月 = 2017 年 10 月
-
检查您的格式,您将月份传递为 22。更改您的解析参数或 simpledateformat
标签: java scala date simpledateformat