计算时差的Andr​​oid [英] Calculate Time Difference in Android

查看:108
本文介绍了计算时差的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的Andr​​oid.I找不到任何方法来计算时间difference.So请帮助我。我设计了一个简单的应用程序。在这个程序予了3 EditTexts和在这些的EditText欲输入的登录时间和注销时间然后在数据库存储这些值,而在第三的EditText我想显示这两个时间之间的差。

I am new in Android.I can't find any way to calculate the time difference.So please help me. I designed a simple application. In this program I took 3 EditTexts and in these EditText I want to input the login time and logout time then store these values in the Database, And in the 3rd EditText I want to display the difference between these two time.

推荐答案

您可以使用标准的Java API调用:

You can use standard Java api calls:

System.nanoTime()
System.currentTimeMillis()

此外,检查这些 2 <一href="http://stackoverflow.com/questions/1198068/android-java-util-calendar-time-difference">links用于计算时间差。

Also, check out these two links for calculating time difference.

这篇关于计算时差的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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