当前位置: 移动技术网 > IT编程>移动开发>Android > Android开发之获取系统当前时间的方法

Android开发之获取系统当前时间的方法

2018年09月13日  | 移动技术网IT编程  | 我要评论

就业培训,夏青播音,快乐大本营林依晨

获取当前时间

system.currenttimemillis()//获取当前时间(毫秒,long型)

将时间转为特定格式

date date = new date(system.currenttimemillis());

simpledateformat dateformat = new simpledateformat("yyyymmddhhmmss");

//或 simpledateformat dateformat = new simpledateformat("yyyy年mm月dd日hh时mm分ss秒");

//或 simpledateformat dateformat = new simpledateformat("yyyy年mm月dd日 hh:mm:ss");

string curtime =dateformat.format(date);//将时间转换为固定格式(年月日时分秒)

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网