Android 获取当前日期 时间很方便 直接调用Calendar类即可
定义变量
private int mHour;
private int mMinute;
private int mYear;
private int mMonth;
private int mDay;
调用如下
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR); //获取当前年份
mMonth = c.get(Calendar.MONTH);//获取当前月份
mDay = c.get(Calendar.DAY_OF_MONTH);//获取当前月份的日期号码
mHour = c.get(Calendar.HOUR_OF_DAY);//获取当前的小时数
mMinute = c.get(Calendar.MINUTE);//获取当前的分钟数
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Zengyangtech/archive/2010/05/04/5554989.aspx