This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi all, Is there any way to get the systems time through a java program ? I tried using the getProperties option but it just gives informations related to Zone ... I need to get the Systems time during which a program of mine is running ... thanks kavya
Hi Kayva, You can get the current system time using <code>java.util.Date();</code> Hope that helps. ------------------ Jane Griscti Sun Certified Java 2 Programmer "When ideas fail, words come in very handy" -- Goethe
I think it's best to use System class for this and get the time from the System. Using System.currentTimeMillis()
Val SCJP <BR>going for SCJD
kavya krushi
Ranch Hand
Joined: Oct 25, 2000
Posts: 48
posted
0
Jane , val Thanks alot for your responces ... I'd already tried both of these options ... I need to get the timing info in the actual format ( not just milliseconds) ... I tried the toString method but it does not seem to work ... is there any particular method which prints the time/date in the actual format ??? thanks kavya
Val Dra
Ranch Hand
Joined: Jan 26, 2001
Posts: 439
posted
0
Use SimpleDateFormat class to format the date to look how you like.