Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { public static long getLongDate(String date) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault()); sdf.setTimeZone(TimeZone.getDefault()); Date d = sdf.parse(date); return d.getTime(); } catch (Exception e) { e.printStackTrace(); } return 0; } public static String getTime(long date) { final String timeFormatString = "h:mm "; DateFormat df = new SimpleDateFormat(timeFormatString, Locale.getDefault()); Date d = new Date(date); return df.format(d); } }