How to find epoch format current time of GMT using java
问题 I have written below code which is running, and giving output. But I'm not sure It's a right one. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = new Date(); sdf.setTimeZone(TimeZone.getTimeZone("GMT-7")); String value = sdf.format(date); System.out.println(value); Date date2 = sdf.parse(value); long result = date2.getTime(); System.out.println(result); return result; The above code what I'm trying is, I just need to get the current time of GMT time zone and