• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unix miliseconds

 
Fernando Dominguez
Ranch Hand
Posts: 104
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need that the UNIX comand date shows milliseconds,

how can i do that? which modifiers sould I use?

Is any other UNIX comand able to do what I have requested?

thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain what the problem is in more detail? Does this really have anything to do with Unix?

You can use class java.text.SimpleDateFormat to display dates and times in the format you like. See the API documentation of that class; there are options to format dates and times with milliseconds.
 
Fernando Dominguez
Ranch Hand
Posts: 104
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post edited
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha, you're talking about the Unix date command, not a Java program.

Try the command: man date to get a description of the date command and all possible options. However, when I do this on Mac OS X, I don't see any way to make it show milliseconds. This might be different on your Linux system.

In Java, you can do it like this:
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note, you may or may not get an answer that is accurate to the millisecond, even if the command displays what it claims are milliseconds, or if the API returns something in milliseconds. Its hardware specific if there is a clock more accurate than the old PC standard, which had about a 18 millisecond accuracy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic