aspose file tools
The moose likes Beginning Java and the fly likes How to get Current Time in Java.... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How to get Current Time in Java.... " Watch "How to get Current Time in Java.... " New topic
Author

How to get Current Time in Java....

Maya sekar
Ranch Hand

Joined: Sep 22, 2011
Posts: 70
Hi guys,

I need to get the current time (as displayed on the system) in my program and schedule a task to run at a particular time everyday.... I heard in java the time is displayed by UTC Time.... Will it not be possible to get the local time?
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

Maya sekar wrote:I heard in java the time is displayed by UTC Time....

That's not true. You can display the time in any timezone you like.

You get the current time by simply creating a new java.util.Date object. You can format it as you like with a SimpleDateFormat. By default it will use the local timezone of your computer, but you can tell the SimpleDateFormat object to display it in any other timezone.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Maya sekar
Ranch Hand

Joined: Sep 22, 2011
Posts: 70
Hi Jesper,

Thank you loads for your time and response..... That is exactly what I was looking for....
Thanks again....
Have a nice day
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Current Time in Java....
 
Similar Threads
system time and day
JSP calendar problem
How to get URL information
date problem
how to get a current date and time in java?