Scala 使用 nscala-time 获取当前时间毫秒

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36141135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 08:06:09  来源:igfitidea点击:

Scala get current-time millis with nscala-time

scalanscala-time

提问by agusgambina

I am trying to get the current time in millis doing this

我正在尝试以毫秒为单位获取当前时间

DateTime.now.millis

but I get

但我明白了

Property[millisOfSecond]

Which is the way to get the current time in millis with nscala-time?

使用 nscala-time 以毫秒为单位获取当前时间的方法是什么?

I want to do this, using the same library

我想这样做,使用相同的库

回答by Sean

Alternatively, you can try:

或者,您可以尝试:

System.currentTimeMillis()

回答by agusgambina

My bad, it was

我的错,是

DateTime.now(DateTimeZone.UTC).getMillis()

I leave the answer just in case is useful for someone else.

我留下答案以防万一对其他人有用。