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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:16:50+00:00 2026-05-29T18:16:50+00:00

The requirement is to simply to get the current wall time ( including the

  • 0

The requirement is to simply to get the current wall time (including the correct DST adjustment) for a given Time Zone.

There seems to be a few questions in SO hovering around this, but I can’t seem to find a straight answer (in SO, Joda doco or googling) with a low friction way of getting the wall time. It seems like with the given inputs (current UTC time and desired TZ) I should be able to chain a couple methods from the Joda Time library to achieve what I want but there seems to be a desire in said examples to evaluate + handle offsets / transitions in application code – I want to avoid this if possible and just use Jodas best effort based on its set of static TZ rules available.

For the purposes of this question, lets assume that I wont be using any other third party services (network based or other binaries), just what is available from the JDK and JodaTime library.

Any pointers appreciated.

Update:
This was actually a gaffe on my behalf. I had a calculated UTC offset based on the requests longitude, while this works obviously you still need regional information to get the correct DST adjustment..

double aucklandLatitude = 174.730423;
int utcOffset = (int) Math.round((aucklandLatitude * DateTimeConstants.HOURS_PER_DAY) / 360);
System.out.println("Offset: " + utcOffset);

DateTimeZone calculatedDateTimeZone = DateTimeZone.forOffsetHours(utcOffset);
System.out.println("Calculated DTZ: " + calculatedDateTimeZone);
System.out.println("Calculated Date: " + new DateTime(calculatedDateTimeZone));
System.out.println();
DateTimeZone aucklandDateTimeZone = DateTimeZone.forID("Pacific/Auckland");
System.out.println("Auckland DTZ: " +  aucklandDateTimeZone);
System.out.println("Auckland Date: " + new DateTime(aucklandDateTimeZone));

prints

Offset: 12
Calculated DTZ: +12:00
Calculated Date: 2012-02-08T11:20:04.741+12:00

Auckland DTZ: Pacific/Auckland
Auckland Date: 2012-02-08T12:20:04.803+13:00

So here in sunny Auckland, NZ we are +12 but +13 in the DST period.

My bad. Thanks for the answers nonetheless, made me see my mistake.

  • 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-29T18:16:51+00:00Added an answer on May 29, 2026 at 6:16 pm

    Have you looked at the DateTime constructor:

    DateTime(DateTimeZone zone) 
    

    This constructs a DateTime representing the current time in the specified timezone.

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

Sidebar

Related Questions

I have a requirement to generate a report in WPF which is simply a
Given a class name as a string, how do I get the package name
My simple requirement: Reading a huge (> a million) line test file (For this
the Requirement in simple words goes like this. Its a charting Application ( kinda
I have a simple requirement, i need a map of type . however i
I have a simple requirement as mentioned below: A ListView or any control displays
This is a simple requirement: I want to add a set of strings to
I am having a very simple requirement.I need the border on left and right
My SQL is rusty -- I have a simple requirement to calculate the sum
I have an ASP ListView, and have a very simple requirement to display numbers

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.