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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:52:40+00:00 2026-06-11T05:52:40+00:00

A date (as the Date temporal type) is stored in my DB like this:

  • 0

A date (as the Date temporal type) is stored in my DB like this: 31.10.2012
When I display it in the UI, it is rendered like this per default: 2012-10-31
I convert it using <f:convertDateTime pattern="dd.MM.yyyy" /> and unexpectedly it turns to
30.10.2012

The SimpleDateconverter, fed with the same date and the same format string returns 31.10.2012, as expected.

What am I missing?

Thank you

EDIT : for dates stored as Timestamp the same conversion yields correct results, so I suppose it has something to do with the Date interpreted as the exact midnight which in turn might be interpreted to belong to 2 different days. But I still have no clue where to define the behaviour and what would be the best workaround.

  • 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-11T05:52:42+00:00Added an answer on June 11, 2026 at 5:52 am

    This is undoubtedly a timezone-related issue.

    JSF defaults to GMT (UTC) in date/time conversion. So if your server platform default timezone is GMT+X (not GMT-X), then the time will go back in the past X-amount of hours. If the time is already 00:00:00 (midnight), then the date will even go back one day in the past.

    There are 2 standard ways to achieve your functional requirement anyway:

    1. Tell JSF to use the server platform default timezone instead for all date/time conversion by adding the following context parameter to web.xml:

      <context-param>
          <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
          <param-value>true</param-value>
      </context-param>
      
    2. Alter every <f:convertDateTime> to explicitly specify the webapp-specific timezone. As you’re based in Germany and the date format pattern also confirms this, I’ll assume CET.

      <f:convertDateTime ... timeZone="CET" />
      

    In any case, using a non-universal or even mixed timezone throughout the application is not recommendable. It’s recommend to set the timezone in all layers and environments to UTC. Not only in the server and front end tier and presentation layer, but also in the SQL database and back end tier and persistence layer. This way the code is not sensitive to timezone and DST(!) related matters and you can just focus on altering the timezone during presentation only, if necessary.

    See also:

    • Daylight saving time and time zone best practices
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field with temporal type as Timestamp to save both date and
I would like to convert this SQL statement to a JPQL equivalent. SELECT *
I tried to use the DataTime in my entity class. Adding @Temporal(TemporalType.DATE) above the
date(Y,1340896077)//1340896077 are the seconds till 2012 from 1970 gives 2012 which is normal And
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
echo date('H:i', time()); // 10:15 echo date('H:i', strtotime($this->deadline)); // 10:05 $delay = time() -
echo date(W,strtotime('2010-01-01')); This outputs 53. I would expect it to output 1. Can anyone
With a table created using this SQL Create Table X ( ID varchar(4) Not
All, I am using JPA for this application and annotations for Mapping entities. I
I have a, say, daily income data set of numeric Temporal Properties , like:

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.