System.out.println(new Date());
Thu Feb 23 04:57:57 ACT 2012
I am running it in a main method. And my system current time is PKT. But it’s giving me ACT time.
Any idea? How to get correct system’s time?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The problem appears to be with the time zone, not the
Datevalue itself. So instead of printing out the current date, use something like this to print out the current time zone:For example, for me that prints:
Once you know more details about what Java thinks your default time zone is, you can start looking for why it thinks that. Is there anything about how you’re running Java which is non-standard? Any environment variables which look suspiciously like the incorrect time zone?
You might also want to print out the following system properties, which are used when determining the time zone:
(Print them out before getting the default time zone –
user.timezoneis set as part of fetching it, if it wasn’t set before.)