Posted on April 28, 2020 by vladmihalcea
How to map Date and Timestamp with JPA and Hibernate
Introduction In this article, I’m going to show you what is the best way to map date and timestamp column types when using JPA and Hibernate. While there are many options to map date and timestamp columns on the Java side, as you will soon see, not all of them are suitable.
Posted on March 14, 2017 by vladmihalcea
How to store date, time, and timestamps in UTC time zone with JDBC and Hibernate
Introduction Dealing with time zones is always challenging. As a rule of thumb, it’s much easier if all date/time values are stored in the UTC format, and, if necessary, dealing with time zone conversions in the UI only. This article is going to demonstrate how you can accomplish this task with JDBC and the awesome hibernate.jdbc.time_zone configuration property.
Posted on November 17, 2014 by vladmihalcea
A beginner’s guide to Java time zone handling
Basic time notions Most web applications have to support different time-zones and properly handling time-zones is no way easy. To make matters worse, you have to make sure that timestamps are consistent across various programming languages (e.g. JavaScript on the front-end, Java in the middle-ware and MongoDB as the data repository). This post aims to explain the basic notions of absolute and relative time. Epoch An epoch is a an absolute time reference. Most programming languages (e.g Java, JavaScript, Python) use the Unix epoch (Midnight 1 January 1970) when expressing a given… Read More