LoginSignup
8
6

More than 5 years have passed since last update.

Scala:日付をISO-8601形式にフォーマットしたい

Posted at

java.util.DateISO-8601の形式にフォーマットする方法。

val tz = java.util.TimeZone.getTimeZone("UTC")
val df = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
df.setTimeZone(tz)
df.format(new java.util.Date())  //> res0: String = 2014-06-27T09:54:57Z
8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6