Android获取系统时间的几种方式
来源:互联网 发布:mac版office2016闪退 编辑:程序博客网 时间:2024/05/23 14:58
方式一:
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss"); Date curDate = new Date(System.currentTimeMillis()); //获取当前时间 String str = formatter.format(curDate);
方式二:
long time=System.currentTimeMillis(); final Calendar mCalendar=Calendar.getInstance(); mCalendar.setTimeInMillis(time); 取得小时:mHour=mCalendar.get(Calendar.HOUR); 取得分钟:mMinuts=mCalendar.get(Calendar.MINUTE); Time t=new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料 t.setToNow(); // 取得系统时间。 int year = t.year; int month = t.month; int date = t.monthDay; int hour = t.hour; // 0-23 DateFormat df = new SimpleDateFormat("HH:mm:ss"); df.format(new Date());
阅读全文
0 0
- Android--获取系统时间的几种方式
- Android--获取系统时间的几种方式
- Android--获取系统时间的几种方式
- Android获取系统时间的几种方式
- Android--获取系统时间的几种方式
- Android获取系统时间的几种方式
- android--获取系统时间的几种方式
- Android--获取系统时间的几种方式
- 获取系统时间的几种方式
- 笔记26 | Android获取系统时间的几种种方式
- C语言获取系统时间的几种方式
- C语言获取系统时间的几种方式
- C语言获取系统时间的几种方式
- C语言获取系统时间的几种方式
- C语言获取系统时间的几种方式 !
- C语言获取系统时间的几种方式 !
- C语言获取系统时间的几种方式
- C语言获取系统时间的几种方式 !
- 小程序开发踩坑-input组件
- Android canvas.drawXXX参数问题
- JAVA jvm调优
- unity 计时器
- ES6总结--数据类型的扩展
- Android获取系统时间的几种方式
- [ttserver]一、ttserver的简单使用
- substr
- 原生js实现ajax异步加载
- OpenCV探索之路(十):图像修复技术
- 测试博客: as快捷键
- Angular开发(十八)-路由的基本认识
- top命令查看内存和多核CPU的使用
- IjkMediaPlayer.reset()耗时的一个解决方案