谷歌眼镜时间

时间:2014-06-18 14:27:33

标签: time google-glass

有没有办法在Google Glass中以语法方式获得时间?我正在使用System.currentTimeMillis();但它给了我一个非常长的数字,例如:1403101657961。我想要用户在打开Glass时看到的实际时间。感谢。

2 个答案:

答案 0 :(得分:0)

您需要做的就是创建一个Date对象,如下所示:

Date dt = new Date(System.currentTimeMillis());

如果您希望将其作为格式化字符串,则可以查看SimpleDateFormat

答案 1 :(得分:0)

您可以使用课程SimpleDateFormat格式化您的日期时间。

使用您的millisec创建日期:

  

Date date= new Date(System.currentTimeMillis());

然后用SDF格式化

  

new SimpleDateFormat(""yyyy.MM.dd G 'at' HH:mm:ss z").format(date)