Convert timestamp to UTC timezone

后端 未结 2 1358
遥遥无期
遥遥无期 2021-01-03 08:14
public static long getCurrentEpochTimeStamp(String timeStamp) throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\'T\'HH:mm:ss\'.0Z\'\");         


        
2条回答
  •  独厮守ぢ
    2021-01-03 08:46

    Set time zone to your SimpleDateFormat object.

    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    

提交回复
热议问题