Java – how to convert dates to UTC

I need to change the date format to UTC format

I need to convert the LastModified date of the file in UTC format

Solution

String lv_dateFormateInUTC=""; //Will hold the final converted date      
String lv_dateFormateInUTC=""; //Will hold the final converted date      
SimpleDateFormat lv_formatter = new SimpleDateFormat(); 
lv_formatter.setTimeZone(TimeZone.getTimeZone("UTC"));  
lv_dateFormateInUTC = lv_formatter.format(lv_localDate);

Like this!!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>