Calendar calendar = Calendar.getInstance();
long unixTime = calendar.getTimeInMillis();//这是时间戳
Logger.i(TAG,"calendar--->>>"+"当前时间为:" + calendar.get(Calendar.YEAR) +
"年 " + calendar.get(Calendar.MONTH) +
"月 " + calendar.get(Calendar.DAY_OF_MONTH) +
"日 " + calendar.get(Calendar.HOUR_OF_DAY) +
"时 " + calendar.get(Calendar.MINUTE) +
"分 " + calendar.get(Calendar.SECOND) +
"秒");
Time times = new Time("GMT+8");
/*对于已经设定为GMT时间标准的dateFormat来说,
一切需要他转换的字符串日期都是GMT标准时间,
转换后返回的Date由于默认
*遵守系统默认时区,所以转换给Date的日期需要+8
(例如北京标准时区),也就是时区与标准不同导致的时差。*/
times.setToNow();
int year = times.year;
int month = times.month;
int day = times.monthDay;
int minute = times.minute;
int hour = times.hour;
int sec = times.second;
Logger.i(TAG,"当前时间为:" + year +
"年 " + month +
"月 " + day +
"日 " + hour +
"时 " + minute +
"分 " + sec +
"秒");
import java.text.SimpleDateFormat;
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());
String str = formatter.format(curDate);
DateFormat df = new SimpleDateFormat("HH:mm:ss");
df.format(new Date());
URL url = null;//取得资源对象
try {
url = new URL("http://www.baidu.com");
URLConnection uc = url.openConnection();//生成连接对象
uc.connect(); //发出连接
ld = uc.getDate(); //取得网站日期时间
Logger.i(TAG,"ld---->>>>"+ld);
} catch (Exception e) {
e.printStackTrace();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有