Back to project page helsinki-testbed2-android.
The source code is released under:
GNU General Public License
If you think the Android project helsinki-testbed2-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package fi.testbed2.util; /* w w w .j a v a 2 s . c om*/ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class TimeUtil { /** * Converts the given timestamp in GMT format to local format. * * @param gmtTimestamp * @return */ public static String getLocalTimestampFromGMTTimestamp(String gmtTimestamp) { if (gmtTimestamp==null || gmtTimestamp.length()==0) { return null; } try { // 201210281940 --> yyyyMMddHHmm SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = simpleDateFormat.parse(gmtTimestamp); SimpleDateFormat sd = new SimpleDateFormat("HH:mm"); sd.setTimeZone(TimeZone.getTimeZone("Europe/Helsinki")); return sd.format(date); } catch (ParseException e) { return null; } } }