如何在 UTC/GMT 中获取当前时间戳,然后如何将此时间戳转换为秒?Itry this 但它抛出异常
SimpleDateFormat sdfu = new SimpleDateFormat("yyyy-MM-dd kk:mm");
Date udate = sdfu.parse(dateAndTimeUTC);
long timeInMillisSinceEpoch123 = udate.getTime();
long durationinSeconds2 = timeInMillisSinceEpoch123 / 1000;
System.out.println("Time in Seconds UTC: " + durationinSeconds2);
有没有更好的方法将 UTC/GMT 时间戳转换为秒?