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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:30:37+00:00 2026-06-13T00:30:37+00:00

I need some advice on this java method. The intent of this method is

  • 0

I need some advice on this java method. The intent of this method is to take a string that represents a date – this string was created from a date in the EST time zone – and convert it to a java Date object in the UTC time zone.

private Date buildValidationDate(String dateString) throws ParseException {
    System.out.println("dateString " + dateString);

    SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyy hh:mm a");
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));  
    dateFormat.setLenient(true);
    Date dt = dateFormat.parse(dateString);

    System.out.println("dt " + dt);

    return dt;
}

the problem I’m seeing is the value of dt seems to be off. For instance, if dateString is ’10/16/2012 12:06 PM’ – I’m expecting the value of dt (in UTC) to be something like ‘Tuesday, October 16, 2012 4:06 PM’. Instead the value of dt is ‘Tue Oct 16 07:06:00 CDT 2012’. This does not seem to be the correct UTC time.

I appreciate any advice, I’m sorry if this seems to be an easy question I have a lot of trouble with Java dates. I’m not sure if I’m coding something incorrectly or if there is something wrong with my methodology. Thanks

  • 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-13T00:30:39+00:00Added an answer on June 13, 2026 at 12:30 am

    Your date is getting converted right. Its just printing value in your default timezone format as java.util.Date is timezone independent. If you want timezone specific handling, please use java.util.Calendar.

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

Sidebar

Related Questions

I need some advice with the Java Print API. I have a program that
I need some advice about this... I have a program that serves as a
I need some advice in building a Java server that handles multiple clients at
I just need some advice on if this is wise. I'm loading my site
Wondering if I could get some advice and direction on this following requirement: Need
I have this thing that i need to do and some advices will be
I need some advice. I’m building an app that has a sequence of 4
I'm learning how to work with threads in Java and I need some advice..
I'm new to Java and I need some advice/information on how to debug my
Alright, I need some advice and best practices from some Rails people. I'm fairly

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.