From 4535ffd0376161b247d09ee570109eb1e329ffc1 Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Singh Date: Tue, 1 Jul 2014 22:17:21 +0530 Subject: [PATCH] Fixed the bug affecting the date and time of retrieved data. --- src/net/aksingh/java/api/owm/AbstractWeatherData.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/net/aksingh/java/api/owm/AbstractWeatherData.java b/src/net/aksingh/java/api/owm/AbstractWeatherData.java index e8adff9..bee14be 100644 --- a/src/net/aksingh/java/api/owm/AbstractWeatherData.java +++ b/src/net/aksingh/java/api/owm/AbstractWeatherData.java @@ -606,7 +606,14 @@ abstract public class AbstractWeatherData { // converting seconds to Date object if (sec != Long.MIN_VALUE) { - this.dateTime = new Date(sec); + /* + @bugfix It always return "Sat Jan 17 04:10:42 CET 1970" + Issue: #3 given at http://code.aksingh.net/owm-japis/issue/3/problem-with-datetime + Incorrect: this.dateTime = new Date(sec); + Correct: this.dateTime = new Date(sec * 1000); + Reason: Date requires milliseconds but previously, seconds were provided. + */ + this.dateTime = new Date(sec * 1000); } else { this.dateTime = null; }