Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7544635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:43:23+00:00 2026-05-30T08:43:23+00:00

System.out.println(new Date()); Thu Feb 23 04:57:57 ACT 2012 I am running it in a

  • 0
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?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:43:24+00:00Added an answer on May 30, 2026 at 8:43 am

    The problem appears to be with the time zone, not the Date value itself. So instead of printing out the current date, use something like this to print out the current time zone:

    import java.util.TimeZone ;
    
    public class Test {
        public static void main(String[] args) throws Exception {
            TimeZone zone = TimeZone.getDefault();
            System.out.println(zone.getDisplayName());
            System.out.println(zone.getID());
        }
    }
    

    For example, for me that prints:

    Greenwich Mean Time
    Europe/London
    

    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:

    user.timezone
    user.country
    java.home
    

    (Print them out before getting the default time zone – user.timezone is set as part of fetching it, if it wasn’t set before.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following works (shows UTC time) TimeZone.setDefault(TimeZone.getTimeZone(UTC)); System.out.println(new Date()); but this doesn't (shows local
I have very strange behaviour of Java Date class: System.out.println(new Date().toGMTString()); long l =
I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat(mm/DD/yyyy); System.out.println((Date)formatter1.parse(08/16/2011)); When I
Try this: DateFormat df = new SimpleDateFormat(y); System.out.println(df.format(new Date())); Without reading the javadoc for
I wonder why 'Y' returns 2012 while 'y' returns 2011 in SimpleDateFormat : System.out.println(new
SimpleDateFormat format = new SimpleDateFormat(GD_yyyyMMdd_HHmmss); System.out.println(format.format(new Date())); I want a result like 'GD_20120604_164534' but
int[] arrc = new int[] {1, 2, 3}; System.out.println(new ArrayList(Arrays.asList(arrc))); prints address, but i
byte[] bytes = new byte[] { 1, -1 }; System.out.println(Arrays.toString(new String(bytes, UTF-8).getBytes(UTF-8))); System.out.println(Arrays.toString(new String(bytes,
The following compiles fine: Object o = new Object(); System.out.println(o instanceof Cloneable); But this
Properties myProp = new Properties(); myProp.put(material, steel); Properties prop1 = new Properties(myProp); System.out.println(prop1.get(material) +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.