Command to get time in milliseconds

后端 未结 12 940
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 04:01

Is there a shell command in Linux to get the time in milliseconds?

12条回答
  •  旧巷少年郎
    2020-12-02 04:20

    • date +"%T.%N" returns the current time with nanoseconds.

      06:46:41.431857000
      
    • date +"%T.%6N" returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds.

      06:47:07.183172
      
    • date +"%T.%3N" returns the current time with nanoseconds rounded to the first 3 digits, which is milliseconds.

      06:47:42.773
      

    In general, every field of the date command's format can be given an optional field width.

提交回复
热议问题