在Java中,可以使用System.currentTimeMillis()方法来获取当前时间的毫秒时间戳,然后将其除以1000得到秒时间戳。示例代码如下:
long currentTimeMillis = System.currentTimeMillis();long currentSeconds = currentTimeMillis / 1000;System.out.println("当前时间的秒时间戳:" + currentSeconds);使用上述代码,即可获取当前时间的秒时间戳。


