public static Date getDateFromTable(LuaTable time) {
        Calendar c = Calendar.getInstance(tzone);
        c.set(Calendar.YEAR,(int)LuaState.fromDouble(time.rawget(YEAR)));
        c.set(Calendar.MONTH,(int)LuaState.fromDouble(time.rawget(MONTH))-1);
        c.set(Calendar.DAY_OF_MONTH,(int)LuaState.fromDouble(time.rawget(DAY)));
        Object hour = time.rawget(HOUR);
        Object minute = time.rawget(MIN);
        Object seconds = time.rawget(SEC);
        Object milliseconds = time.rawget(MILLISECOND);
        //Object isDst = time.rawget(ISDST);
        if (hour != null) {
            c.set(Calendar.HOUR_OF_DAY,(int)LuaState.fromDouble(hour));
        } else {
            c.set(Calendar.HOUR_OF_DAY, 0);
        }
        if (minute != null) {
            c.set(Calendar.MINUTE,(int)LuaState.fromDouble(minute));
        } else {
            c.set(Calendar.MINUTE, 0);
        }
        if (seconds != null) {
            c.set(Calendar.SECOND,(int)LuaState.fromDouble(seconds));
        } else {
            c.set(Calendar.SECOND, 0);
        }
        if (milliseconds != null) {
            c.set(Calendar.MILLISECOND, (int)LuaState.fromDouble(milliseconds));
        } else {
            c.set(Calendar.MILLISECOND, 0);
        }
        // TODO: daylight savings support(is it possible?)
        return c.getTime();
    }
converts the relevant fields in the given luatable to a Date object.
@param time LuaTable with entries for year month and day, and optionally hour/min/sec
@return a date object representing the date frim the luatable.
main/src/main/java/cgeo/geocaching/wherigo/kahlua/stdlib/OsLib.java