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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:10:55+00:00 2026-06-15T00:10:55+00:00

I have this date in a PostgreSQL 9.1 database in a timestamp without time

  • 0

I have this date in a PostgreSQL 9.1 database in a timestamp without time zone column:

2012-11-17 13:00:00

It’s meant to be in UTC, and it is, which I’ve verified by selecting it as a UNIX timestamp (EXTRACT epoch).

int epoch = 1353157200; // from database
Date date = new Date((long)epoch * 1000);
System.out.println(date.toGMTString()); // output 17 Nov 2012 13:00:00 GMT

However, when I read this date using JPA/Hibernate, things go wrong. This is my mapping:

@Column(nullable=true,updatable=true,name="startDate")
@Temporal(TemporalType.TIMESTAMP)
private Date start;

The Date I get, however, is:

17 Nov 2012 12:00:00 GMT

Why is this happening, and more importantly, how can I stop it?

Note that I just want to store points in time, universally (as java.util.Date does), and I couldn’t care less about timezones, except that I obviously don’t want them to corrupt my data.

As you’ve probably deduced, the client application which connects to the database is in UTC+1 (Netherlands).

Also, the choice for the column type timestamp without time zone was made by Hibernate when it automatically generated the schema. Should that maybe be timestamp with time zone instead?

  • 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-15T00:10:56+00:00Added an answer on June 15, 2026 at 12:10 am

    If a database does not provide timezone information, then the JDBC driver should treat it as if it is in the local timezone of the JVM (see PreparedStatement.setDate(int, Date)):

    Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.

    The Javadoc and the JDBC specification do not explicitly say anything about ResultSet etc, but to be consistent most drivers will also apply that rule to dates retrieved from the database. If you want explicit control over the timezone used, you will need to use the various set/getDate/Time/Timestamp methods that also accept a Calendar object in the right timezone.

    Some drivers also provide a connection property allowing you to specify the timezone to use when converting to/from the database.

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

Sidebar

Related Questions

I have a field in my postgres database using the time (without time zone)
i have this date's & Time's: date1: 10/04/2010 - Time: 08:09 date2: 11/04/2010 -
I have this table: ID(INT) DATE(DATETIME) Under the DATE column there are a lot
I have this function which gives me ( for a current date ) -
I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying
We have this PHP application which selects a row from the database, works on
I have imported a PostgreSQL database and I keep getting this error: ERROR: operator
I have a PostgreSQL 9.1 database with a table containing a timestamp and a
I have a database in PostgreSQL. And I have sql query (which btw works
I have the following from a Microsoft SQL Server database for date/time value: 0x00009CEF00A25634

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.