0

In my web application I am using Google calendar. Due to day light savings issue day light savings time is added when I saved the events in Google calendar through my application.

My application uses Java 1.6 and Google calendar v3.

What is the best solution to handle every time zone in the world?

zubergu
  • 3,646
  • 3
  • 25
  • 38
kranthi
  • 55
  • 1
  • 10
  • Could you edit your question to include the code where you get this date and store it into google calendar? – Kenster Apr 01 '15 at 11:36

1 Answers1

1

You may use SimpleDateFormat class as stated here before Java8

or may use ZonedDateTime in Java 8 as mentioned here

Hope that helps.

learner
  • 84
  • 2
  • 13
  • My application uses java6 . SimpleDateFormat is not working . – kranthi Apr 01 '15 at 11:22
  • My application uses java6 . For example if I use "GMT-08:00" day light saving hours are not consider ,If I use "America/Los_Angeles" I will get correct time after adding day light savings . – kranthi Apr 01 '15 at 11:31
  • Yes, you need a full timezone to consider Daylight Savings. See this link http://en.wikipedia.org/wiki/List_of_tz_database_time_zones. And also: http://stackoverflow.com/questions/10545960/how-to-tackle-daylight-savings-using-timezone-in-java – learner Apr 01 '15 at 12:18
  • Ok . I will try in this way .Thank you. – kranthi Apr 01 '15 at 13:43
  • Glad to help. You may want to accept the answer as 'accepted answer'. – learner Apr 01 '15 at 13:52
  • where is the option provided ? – kranthi Apr 02 '15 at 06:01
  • To mark an answer as accepted, click on the check mark beside the answer to toggle it from hollow to green (see screenshot below) http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – learner Apr 04 '15 at 16:31