MCQs > IT & Programming > Java > Which code snippets will correctly convert from one time zone to another time zone?

Java MCQs

Which of the following code snippets will correctly convert from one time zone to another time zone?

Answer

Correct Answer: DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); formatter.setTimeZone(new TimeZone("GMT-8")); Date date = formatter.parse("01/01/2012 05:00:00"); System.out.println(formatter.format(date)); formatter.setTimeZone(new TimeZone("GMT+5")); System.out.println(formatter.format(date));

Explanation:

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it