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 7841777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:10:16+00:00 2026-06-02T16:10:16+00:00

Sorry if this is a re-post. I did not find a suitable answer. Please

  • 0

Sorry if this is a re-post. I did not find a suitable answer.

Please ignore best practices and use of deprecated apis.

I want to format the following date “Mon May 19 02:16:52 EDT 2003” into “MM/dd/yyyy HH:mm:ss“. Again, I only want to change the output format and this is being executed from my laptop which is in EST.

My Windows Regional Settings are:

Current time zone: Eastern Daylight Time

Timezone: (GMT-05:00) Eastern Time (US & Canada)

Automatically adjust clock for daylight saving changes: Checked

This java code does it:

Date aDate = new Date("Mon May 19 02:16:52 EDT 2003");
SimpleDateFormat sdf = new SimpleDateFormat( "MM/dd/yyyy HH:mm:ss");
System.out.println("Formatted Date: " + sdf.format(aDate));

Output is

Formatted Date: 05/19/2003 02:16:52

Now I change the windows setting to the following (only uncheck the DST setting)

Current time zone: Eastern Daylight Time

Timezone: (GMT-05:00) Eastern Time (US & Canada)

Automatically adjust clock for daylight saving changes: Checked

Output is:

Formatted Date: 05/19/2003 01:16:52

Questions:

  1. Why is the output off by an hour?
  2. Does java use Windows DST settings even when formatting? I though java maintains its own data for DST settings times for various timezones.
  • 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-06-02T16:10:17+00:00Added an answer on June 2, 2026 at 4:10 pm

    Internally, dates are stored by a long value that represents the number of milliseconds past some epoch. When you clicked off the daylight savings time on you machine, you changed your timezone. So Java is using the same time number with a different timezone and that’s why you have what you have

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

Sidebar

Related Questions

Did my best to not post this question but i just can not figure
Sorry for this long post. The question is however small but requires full detail.
First I am sorry about the length of this post, but I wanted to
Sorry for the double post, I will update this question if I can't get
Sorry this is not a very well defined question, I am thinking about an
Sorry this is probably super basic. But in all my javabean examples, I've not
Sorry for the lengthy post, I just want to illustrate my situation as best
I was just wondering what did the UML diagram from this post made from?
This is thirty post in one houre . so i am sorry ! but
Disclaimer: please excuse the religious aspects of this post. Anyway, the title says what

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.