aspose file tools*
The moose likes Linux / UNIX and the fly likes Unix miliseconds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Unix miliseconds" Watch "Unix miliseconds" New topic
Author

Unix miliseconds

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 102

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

Joined: Aug 16, 2005
Posts: 13875
    
  10

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: 102

post edited
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

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: 4637
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unix miliseconds
 
Similar Threads
Forte
Haw to make a simple compilator for same comand
weblogic 6.0 installation on windows ME
Need help to install Eclipse on AIX-Unix
Finding the modified date time of a file