Android – 无法使用java.time.Instant获取微秒

huangapple 未分类评论52阅读模式
英文:

Android - Not able to get microseconds using java.time.Instant

问题

我无法从Android中使用java.time.InstantInstant.now())获取微秒。

> 我从Android获取的日期时间没有微秒,像是2020-04-10T12:43:40.442Z

但是当我执行一个独立的Java程序,使用java.time.InstantInstant.now()

> 我获取带有微秒的日期时间,例如2020-04-10T12:43:40.442179Z

这个问题似乎与Android Studio中的Java版本有关。请帮助我解决这个问题。

注意:

我已经安装了Android Studio - 3.6.1,并在Android Studio设置中进行了JDK 9(9.0.4)的设置。

英文:

I am unable to get the microseconds using java.time.Instant (Instant.now()) from android.

> I am getting the date time without microseconds like 2020-04-10T12:43:40.442Z from android

But when I execute a independent java program, with the use of java.time.Instant (Instant.now())

> I am getting the date time with microseconds like 2020-04-10T12:43:40.442179Z

It seems the issue is with java versions in android studio. Please help me to fix this issue.

Note:

I have installed Android Studio - 3.6.1 and done the JDK 9(9.0.4) Setup in the Android studio Settings.

huangapple
  • 本文由 发表于 2020年4月10日 20:53:07
  • 转载请务必保留本文链接:https://java.coder-hub.com/61140653.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定