Code example for Time

Methods: set, toString

0
public class UtcUtil { 
	private static Time mTime = new Time();	
	 
	public static String getCurrentTime() {
		long millis = System.currentTimeMillis();
		mTime.set(millis);
		return mTime.toString().substring(0,15);
	} 
 
	public static String convertMillisToUtc (long millis){
		mTime.set(millis);
		return mTime.toString().substring(0,15);
	} 
 
	public static long revertUtcToMillis (String time) {
		if (time == null || time.length() == 0) {
			return 0; 
		} 
		try { 
		mTime.parse(time);
		} catch (TimeFormatException e) {