Scala 将日期格式化为其他格式返回错误的日期
所以我有Scala 将日期格式化为其他格式返回错误的日期,scala,date,Scala,Date,所以我有dd/mm/yyyydate格式,我想把它转换成datedd-MMM,yyyy格式。 这就是我所尝试的: val s: String = "27/04/2014" val simpleDateFormat: SimpleDateFormat = new SimpleDateFormat("dd/mm/yyyy") val date2 = simpleDateFormat.parse(s) val df = new SimpleDateFormat("dd MMM, yyyy") prin
dd/mm/yyyy
date格式,我想把它转换成datedd-MMM,yyyy
格式。
这就是我所尝试的:
val s: String = "27/04/2014"
val simpleDateFormat: SimpleDateFormat = new SimpleDateFormat("dd/mm/yyyy")
val date2 = simpleDateFormat.parse(s)
val df = new SimpleDateFormat("dd MMM, yyyy")
println(df.format(date2))
结果:
27 Jan, 2014 res0: Unit = ()
改变
val simpleDateFormat: SimpleDateFormat = new SimpleDateFormat("dd/mm/yyyy")
到
检查以下所有代码:
mm
=分钟,mm
=月;请参阅的API文档
val simpleDateFormat: SimpleDateFormat = new SimpleDateFormat("dd/MM/yyyy")