TIMESTAMP是时候吗? 如何在java中获取utc时间并转换为本地时间(毫秒)?
答案 0 :(得分:0)
您可以将时间戳对象转换为本地时间:
object.toLocalDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
https://docs.oracle.com/javase/8/docs/api/java/sql/Timestamp.html#toLocalDateTime--
答案 1 :(得分:0)
使用此
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
System.out.println(cal.getTime());
使用SimpleDateFormatter将其转换为本地时间(毫秒)