Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个日期格式
2011 年 5 月 31 日星期二 17:46:55 +0800
我正在使用的当前格式是
implicit val formats = Serialization.formats(NoTypeHints)
它将产生:
2011-05-31 17:46:55.0
如何制作产生类似字符串的格式 "Tue May 31 17:46:55 +0800 2011"?
"Tue May 31 17:46:55 +0800 2011"
private def formatsWithDate(customDateFormat : SimpleDateFormat): Formats = { new DefaultFormats { override val dateFormatter = customDateFormat } }
通过这种方式,您可以设置自己的日期格式
注意:对于 3.2.9 之前的版本,json4s 将使用 UTC 时区,无论您在 dateformat 中设置什么时区