1. 程式人生 > >Scala日期和字符串互轉

Scala日期和字符串互轉

分享圖片 ava for .com () img parse 字符 bsp

import java.util.Date
import java.text.SimpleDateFormat
case class myclass(id :String,actionDate:java.util.Date)
val TIME_FORMAT= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
val actionTime = TIME_FORMAT.parse("2010-10-10 10:10:10")

val actionTimeString = TIME_FORMAT.format(actionTime)
val mTime = actionTime.getTime()

技術分享圖片

Scala日期和字符串互轉