Java tutorial
//package com.java2s; import android.text.format.Time; public class Main { public static String getNowTime() { Time time = new Time(); time.setToNow(); int year = time.year; int month = time.month + 1; int day = time.monthDay; int minute = time.minute; int hour = time.hour; int sec = time.second; return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + sec; } }