problem with datetime

Issue #3 resolved
Danny Noferi created an issue

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)

  1. Michael Ogrinz

    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.

  2. Michael Ogrinz

    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;

  3. Ashutosh Kumar Singh repo owner

    This problem is fixed in the latest version. Kindly use the latest 2.5.0.2 version which has all known bugs fixed. Thanks!

  4. Ashutosh Kumar Singh 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!

  5. Log in to comment