Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Locale; import java.util.TimeZone; public class Main { public static String getUTCTimeFromLocal(String localTime) { java.util.Date UTCDate = null; String localTimeStr = null; SimpleDateFormat format = new SimpleDateFormat("HH:mm", Locale.getDefault()); try { UTCDate = format.parse(localTime); localTimeStr = format.format(UTCDate.getTime() - TimeZone.getDefault().getRawOffset()); } catch (ParseException e) { e.printStackTrace(); } return localTimeStr; } }