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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:31:13+00:00 2026-05-25T10:31:13+00:00

Why does Joda Time allow a Period constructor to take two LocalTimes but there

  • 0

Why does Joda Time allow a Period constructor to take two LocalTimes but there is no Duration constructor like that?

I want to know because it may aid in my understanding of the best use of Joda Time.

Here’s my thinking: Duration is good for social convention unaware applications and the lack of awareness is what makes it different from Period. LocalTime is good for convention unaware use because it has no timezone. This suggests Duration should be used with LocalTime and vice-versa.

  • 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-25T10:31:13+00:00Added an answer on May 25, 2026 at 10:31 am

    A Duration is the amount of time between two precise Instants in time (which are completely independent of human concepts like years, days, and seconds). LocalTimes, however, represent ambiguous points in time (they require a date and time zone to define an Instant).

    It makes sense to say there’s a “standard duration” (the duration of the period assuming no DST, no leap years, no leap seconds (which Joda chronologies don’t support, admittedly)) between two LocalTimes, but there’s not enough information to compute a “true duration”. I suspect this is why Duration doesn’t have that constructor.

    For example, let’s suppose we have two LocalTimes: one representing 1:00 AM and 4:00 AM. 99% of the time, it’d make sense to say that’s a duration of 3 hours. But, if they represent times on the day of a Daylight Saving Time switch, the duration would be 2 hours or 4 hours.

    Period is defined more broadly, where it make senses to have a period between two partially-defined times like LocalTimes (just “3 hours” in the example). Periods correspond easily to standard durations, so one can just call period.toStandardDuration().

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

Sidebar

Related Questions

Does anyone know if there's a method in Joda Time or Java itself which
I want to get the difference between two Java Date objects. I've used Joda-Time
Does anyone use have a good regex library that they like to use? Most
Does anyone know of a Mootools script that provides nested sortable but also works
There are three options that I see for handling dates in Java, but I
I'm writing some code that does date and time calculations against the current time.
Does anyone know of a Ruby module that will take an integer and spell
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone out there know what image format results in the fastest loading speeds?
Is there a simple or elegant way to grab only the time of day

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.