Is there a way to get the time in Google Glass pro grammatically? I am using System.currentTimeMillis(); but it gives me a really long number such as: 1403101657961. I want the actual time that the user is looking at when he turns on Glass. Thanks.
Asked
Active
Viewed 71 times
0
-
I presume that the time it returned is in seconds. Convert seconds into the date time. – pynovice Jun 18 '14 at 14:29
-
It is universal time, so its 10:30 now, but in California it is 8:30, there is no way to tell from just 1 number. – Mark Jun 18 '14 at 14:30
-
2The time returned by `Systme.currentTimeMillis()` is milliseconds passed since Unix Epoch in UTC. – Jurgen Camilleri Jun 18 '14 at 14:32
2 Answers
0
All you need to do is create a Date
object like so:
Date dt = new Date(System.currentTimeMillis());
If you want it as a formatted string you can take a look at SimpleDateFormat
.

Jurgen Camilleri
- 3,559
- 20
- 45
0
You can use the class SimpleDateFormat to format your time to Date.
Create a date with your millisec :
Date date= new Date(System.currentTimeMillis());
then format it with SDF
new SimpleDateFormat(""yyyy.MM.dd G 'at' HH:mm:ss z").format(date)

GiBoX
- 135
- 1
- 14