Skip to content

Instantly share code, notes, and snippets.

@alwqx
Last active June 29, 2017 12:02
Show Gist options
  • Save alwqx/765e084f23b292b4b89ccb5a21e8911f to your computer and use it in GitHub Desktop.
Save alwqx/765e084f23b292b4b89ccb5a21e8911f to your computer and use it in GitHub Desktop.
convert timestamp to Date or string in Scala
import java.util.Date
import java.text.SimpleDateFormat
object TS2Date {
def main(args: Array[String]): Unit = {
val ts:BigInt = 1480665459
val df:SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd")
val date:String = df.format(ts.toLong)
//ret: String = 1970-01-18
}
}
@Rushi-Kumar
Copy link

how to get full format of date

@binkabir
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment