/** * Converts a JsDate into a java Date. * * @param jsDate a JsDate value * @return a Date value */ public static Date getDate(JsDate jsDate) { if (jsDate == null) { return null; } return new Date((long) jsDate.getTime()); }
/** * The desired departure time for the route, specified as a Date object. The Date object measures time in milliseconds * since 1 January 1970. If neither departure time nor arrival time is specified, the time is assumed to be "now". */ public final Date getDepartureTime() { return new Date((long) this.getDepartureTimeImpl().getTime()); }
/** * The desired arrival time for the route, specified as a Date object. The Date object measures time in milliseconds * since 1 January 1970. If arrival time is specified, departure time is ignored. */ public final Date getArrivalTime() { return new Date((long) this.getArrivalTimeImpl().getTime()); }
/** * The time of this departure or arrival, specified as a Java Date object. */ public final Date getValue() { return new Date((long) getValueAsJsDate().getTime()); }
public static Date tryParseDate(String date) { try { return new Date(Long.parseLong(date)); } catch (NumberFormatException ignored) { } try { JsDate js = JsDate.create(date); return new Date((long) js.getTime()); } catch (JavaScriptException ignored) { } return null; } }
/** * Alias for {@link #ceil(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date ceil(Date date) { return new Date((long) this.ceil(JsDate.create(date.getTime())).getTime()); }
/** * Alias for {@link #floor(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date floor(Date date) { return new Date((long) this.floor(JsDate.create(date.getTime())).getTime()); }
/** * Get the pickers date. */ protected Date getPickerDate() { try { JsDate pickerDate = getPicker().get("select").obj; return new Date((long) pickerDate.getTime()); } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Alias for {@link #round(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date round(Date date) { return new Date((long) this.round(JsDate.create(date.getTime())).getTime()); }
/** * Alias for {@link #floor(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date floor(Date date) { return new Date((long) this.floor(JsDate.create(date.getTime())).getTime()); }
/** * Alias for {@link #round(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date round(Date date) { return new Date((long) this.round(JsDate.create(date.getTime())).getTime()); }
/** * Get the pickers date. */ protected Date getPickerDate() { try { JsDate pickerDate = getPicker().get("select").obj; return new Date((long) pickerDate.getTime()); } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Alias for {@link #ceil(JsDate)} for a Java date. * * @param date * the date to convert * @return the date */ public final Date ceil(Date date) { return new Date((long) this.ceil(JsDate.create(date.getTime())).getTime()); }
/** * Alias for {@link #floor(JsDate)} for a timestamp. * * @param date * @return the date */ public final double floor(double date) { return this.floor(JsDate.create(date)).getTime(); }
/** * Alias for {@link #floor(JsDate)} for a timestamp. * * @param date * @return the date */ public final double floor(double date) { return this.floor(JsDate.create(date)).getTime(); }
/** * Alias for {@link #round(JsDate)} for a timestamp. * * @param date * @return the date */ public final double round(double date) { return this.round(JsDate.create(date)).getTime(); }
/** * Alias for {@link #round(JsDate)} for a timestamp. * * @param date * @return the date */ public final double ceil(double date) { return this.ceil(JsDate.create(date)).getTime(); }
/** * Alias for {@link #offset(JsDate, int)} for double. * * @param start * the start date * @param step * the number of intervals to add to the start date * @return the computed date */ public final double offset(double start, int step) { return this.offset(JsDate.create(start), step).getTime(); }
/** * Alias for {@link #round(JsDate)} for a timestamp. * * @param date * @return the date */ public final double ceil(double date) { return this.ceil(JsDate.create(date)).getTime(); }
int months = -2; int years = -3; JsDate j = JsDate.create(new Date().getTime()); j.setMonth(j.getMonth() + months); j.setFullYear(j.getFullYear() + years); Date d = new Date((long)j.getTime());