fun format(input: Long, outputFormat: String = "yyyy-MM-dd'T'HH:mm:ss", locale: Locale = Locale.US): String {
SimpleDateFormat(outputFormat, locale).apply {
return format(Date(input))
}
I have the following method above, when I enter the following command:
println(format(1596095340000))
I am expecting to get
2020-07-29T17:49:00
however I end up getting this instead
2020-07-30T07:49:00
Do I have to manually do the offset myself, and if I do how would I do that? I thought that this type of offset would be handled automatically?
I've also adapted answer from another SO post at Converting from Milliseconds to UTC Time in Java and results were different but still not what I expected:
val sdf = SimpleDateFormat()
sdf.timeZone = TimeZone.getTimeZone("PST")
println(sdf.format(Date(1596095340000)))
7/30/20 12:49 AM