problem with datetime
Hi, when I do:
OpenWeatherMap istance = new OpenWeatherMap(apiKey); current = istance.currentWeatherByCityName(CITY_NAME, COUNTRY_CODE); current.getDateTime();
it always return "Sat Jan 17 04:10:42 CET 1970"... Is there any conversion that should I do, to get the current time?
Thanks, Danny
Comments (4)
-
-
The OWM dt # is too small for some reason. I added this line to AbstractWeatherData after line 606, and the dates are now correct. But I'd love to know why this is necessary:
sec=sec*1000;
-
repo owner - changed status to resolved
This problem is fixed in the latest version. Kindly use the latest 2.5.0.2 version which has all known bugs fixed. Thanks!
-
repo owner This was the problem: Date class's constructor needs Milli-seconds and epoch time from OpenWeatherMap.org was in seconds. That's why, multiplication by 1000 because 1 Milli-second = 1 second * 1000.
Simple, wasn't it? Now it's fixed in the latest 2.5.0.2 version. Thanks!
- Log in to comment
I have the same problem. Too bad b/c everything else works great, but I can't use this API if the dates are wrong. I can't find any documentation on how OWM is sending the date either.