Title
l

liminal

02/26/2017, 7:08 PM
Hi all, what is a good way to format a timestamp that's currently stored as millis Long as a date?
The accepted answer, in Kotlin:
val d = Date(millis)
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS")
val dateStr = sdf.format(d)
w

wfisher

02/26/2017, 10:04 PM
You can make an extension function for Long like:
fun Long.toSimpleDT(): String {
    return DateTimeFormat.forPattern("M/dd h:mm:ss a")
            .withZone(DateTimeZone.forID("America/New_York"))
            .print(this * 1000)
}