如何获取当前时间 [英] How to get the current Time

查看:163
本文介绍了如何获取当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得当前时间的Andr​​oid?

当我使用

  INT小时= java.sql.Time.this.getHours();
 

我得到的错误:

 的类型时没有封闭实例处于范围访问
 

解决方案

  INT小时=新的时间(System.currentTimeMillis的())getHours()。
 

How to get the current time in Android?

When i use

int hours = java.sql.Time.this.getHours();

i get the error:

No enclosing instance of the type Time is accessible in scope

解决方案

int hours = new Time(System.currentTimeMillis()).getHours();

这篇关于如何获取当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆