| Author |
Unix miliseconds
|
Fernando Dominguez
Ranch Hand
Joined: Sep 01, 2006
Posts: 93
|
|
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
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
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.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Fernando Dominguez
Ranch Hand
Joined: Sep 01, 2006
Posts: 93
|
|
|
post edited
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
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
Joined: Aug 11, 2007
Posts: 4422
|
|
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.
|
 |
 |
|
|
subject: Unix miliseconds
|
|
|