1.先定义一个Java对象Person: public class Person { String name; int age; int number; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age =
Java版本:1.8开始 import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; /** * Created by Frank */ public class CurrentDatetime { public static void main(String[] args) { // 纪元秒和本地日期时间互换 Instant epochSec = Instant.ofEpochSecond