search

Home  >  Q&A  >  body text

java - jdk中有没有提供纳秒转描述的方法?

比如纳秒数37370571461,如果要转秒数,自己写方法的话,要依次跟1000取整,取余,才能将37370571461纳秒转换成37秒370毫秒571微妙461纳秒,有没有现成的jar包提供了这个方法的实现呢?不需要我再另外自己写方法呢?

PHP中文网PHP中文网2811 days ago408

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:22:57

    There is a ready-made nanosecond to second conversion, but it is not in Chinese, and it cannot express the way of saying nanosecond + millisecond + microsecond. However, your situation is very special. I suggest you convert it directly by intercepting the string. The 3 digits of a certain digit are nanoseconds, the next 3 digits are microseconds, and so on. This is hassle-free and efficient at the same time.

    reply
    0
  • Cancelreply