-2

I want to know how we can manage time zone related changes with Java and Databases. When there is a time change in a particular country (Daylight Saving Time or Some other reason Ex. Russia change time 1 hour backward ) how we can made that change without affecting the code.

"without affecting the code" means without changing the code. Just using some configurations.

rajitha
  • 21
  • 1
  • 5
  • "how we can made that change without affecting the code." this question is so unclear. Can you please edit and clarify it more – Freak Oct 31 '14 at 10:13
  • Are you looking for this? http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html – Alex Oct 31 '14 at 10:18
  • @SimY4 Yes i am looking for that. Can you let me whether that type of facility available in Databases as well?? – rajitha Oct 31 '14 at 10:54
  • @rajitha typically in database you store dates in UTC and perform translation after you fetch it to avoid this kind of problem. – Alex Oct 31 '14 at 11:03
  • @SimY4 Please put this as Answer to Vote :) – rajitha Oct 31 '14 at 11:17
  • @rajitha Please search StackOverflow.com before posting. Your question has been covered in countless other questions and answers. In particular, read this question, [Daylight saving time and time zone best practices](http://stackoverflow.com/q/2532729/642706). – Basil Bourque Nov 02 '14 at 02:09

2 Answers2

2

Use UTC Server-Side

Typically in database you store dates in UTC. You perform date translation after you fetch it to avoid time zone change problems.

tz database

For Java, you can obtain fresh time zone data. Download the latest version of tzdata file, also known as the "Olson database". Add that file to your JVM bundle. See these instructions.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Alex
  • 7,460
  • 2
  • 40
  • 51
0

Postgres related configurations http://www.postgresql.org/docs/9.1/static/datetime-config-files.html

rajitha
  • 21
  • 1
  • 5