0

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.

Mark
  • 11
  • 1

2 Answers2

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