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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:59:13+00:00 2026-06-08T08:59:13+00:00

I have not much experience with MultiTimeZone and / or local dates, so I’m

  • 0

I have not much experience with MultiTimeZone and / or local dates, so I’m getting my hands dirty on this but I do not how how and where to start, so be gently with me 🙂

I have two types of Date(Time) fields:

  1. Date (storing Day, Month and Year)
  2. DateTime (same as 1 but including time)

How should I define my properties in Play?

 @Formats.DateTime(pattern="MM-dd-yyyy")
 public Date reqCompletionDate;

OR should I go with JodaTime (never used it before):

@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
public DateTime reqCompletionDate;

If I go for java.util.Date, how can I convert it to the users local Date format (i.e yyyy-MM-dd)? Plays automatic binding will fail because of the format issues, so I need to create a Custom Binder for it? This will affect all my Date fields, right?

Or would you advise to use getters and setters for all the Date(Time) fields so that I can pass the users Locale to get the correct time. In this case, the automatic bind of Play will fail and I still would need a custom binders for Date and DateTime?

Or am I over-thinking this all and should handle this in a different way? Thanks for your thoughts!

UPDATE: 2012-07-23: I think I will follow these steps:

Step 1: Make play starts and initialize with UTC timezone

Step 2: Make all date time fields same format, according to UTC time zone

Step 3: Convert to users local time as late as possible

When user posts a form containing a local date (time) convert it as soon as possible to UTC time. If I have time I will post my code 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-06-08T08:59:15+00:00Added an answer on June 8, 2026 at 8:59 am

    In short, use JodaTime. java.util.Date should be taken into a quiet field, given a last cigarette, and shot.

    A longer version:

    Multi-Locale can be complicated to get right, and it’s not just a concern of presenting dates and times in the user’s timezone.

    Some examples of the things you need to consider:

    • Is your birthday a day earlier when rendered in an Australian timezone?
    • If the user tells the support guy it happened on Tuesday, but the support guy’s Tuesday is + 7 hours, will he find it in the log?
    • Which midnight should the sale set for the 17th start on?

    java.util.Date is limited to representing a single instant in time. That makes it very hard to cope with those kinds of scenarios. You can’t even tell by examining one whether it is representing a date or a datetime.

    Joda provides separate types for these separate concepts, which makes working with them much simpler. LocalDate for example has no timezone or time component. Your birthday is a LocalDate so it never changes, DateTimes are represented as a different type. There are also types for other concepts like Interval, Duration which makes time/date comparison much easier. In the rare case you have to support locales that don’t have use the Gregorian calendar you can easily swap Chronologies.

    If you’re using JPA, the adapters for Joda exist and work. Also Joda does provide interoperability with java.util.Date if you have to use it elsewhere.

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

Sidebar

Related Questions

I have not had much experience with VBA, but I sometimes use it at
I do not have much experience with jsp. In java I can do, but
I'm currently extending a Site and do not have much experience with symfony. Currently
I have 4 years experience on DotNet, not much. I now learned developing for
I have a fair amount of JSP and JSF experience. Not so much with
I've been working at this for two days and have not had much luck.
I do not have much experience coding systems dealing with web-services. Please help me
I have not much experience in xsl with namespace and i am using xsl
I've tried looking into preg_replace, except that I have not much experience with regular
I do not have much experience using frameworks or anything so that leaves me

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.