public static long getCurrentEpochTimeStamp(String timeStamp) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.0Z'");
Date date = sdf.parse(timeStamp);
return date.getTime();
}
This method returns epoch current timestamp, I need to convert this to UTC timezone.
Set time zone to your SimpleDateFormat
object.
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With