更新时间:2023-09-19 15:32:58
怎么样:
Date expiry = new Date(Long.parseLong(date));
根据 rde6173 的回答并仔细查看问题中指定的输入,1081157732" 似乎是基于秒的纪元值,因此您希望将来自 parseLong() 的 long 乘以 1000 以转换为毫秒,这是 Java 的 Date 构造函数所使用的,因此:
as per rde6173's answer and taking a closer look at the input specified in the question , "1081157732" appears to be a seconds-based epoch value so you'd want to multiply the long from parseLong() by 1000 to convert to milliseconds, which is what Java's Date constructor uses, so:
Date expiry = new Date(Long.parseLong(date) * 1000);