/** * Converts a <tt>java.util.Date</tt> into an <tt>org.tentackle.misc.Date</tt>. * * @param date the util date * @return the sql date, null if date was null */ public static Date toDate(java.util.Date date) { return date == null ? null : new Date(date.getTime()); }
/** * Gets the current date. * * @return current Date */ public static Date today() { return new Date(System.currentTimeMillis()); }
/** * Converts a Calendar into a org.tentackle.misc.Date. * * @param cal the calendar * @return the date, null if cal was null */ public static Date toDate(Calendar cal) { return cal == null ? null : new Date(cal.getTime().getTime()); }
/** * Parses a date. * * @param str the string to parse * @return the date * @throws ParseException if parsing failed */ public static synchronized org.tentackle.common.Date parseDate(String str) throws ParseException { return new org.tentackle.common.Date(getFormatting().dateFormat.parse(str).getTime()); }
/** * Gets the current date with an offset. * * @param dayOffset the offset in days * @param monthOffset the offset in months * @param yearOffset the offset in years * @return the date */ public static Date today(int dayOffset, int monthOffset, int yearOffset) { GregorianCalendar cal = new GregorianCalendar(); cal.add(GregorianCalendar.DATE, dayOffset); cal.add(GregorianCalendar.MONTH, monthOffset); cal.add(GregorianCalendar.YEAR, yearOffset); return new Date(cal.getTimeInMillis()); }
/** * Creates a frozen date. * * @param epoch epochal milliseconds since January 1, 1970, 00:00:00 GMT * @return the frozen date */ public static Date createFrozen(long epoch) { Date date = new Date(epoch); date.freeze(); return date; }
/** * Parses a short date. * * @param str the string to parse * @return the date * @throws ParseException if parsing failed */ public static synchronized org.tentackle.common.Date parseShortDate(String str) throws ParseException { return new org.tentackle.common.Date(getFormatting().shortDateFormat.parse(str).getTime()); }
/** * Gets the SQL-Date. * * @return the org.tentackle.misc.Date, null if field is empty */ @Override public org.tentackle.common.Date getDate() { Date date = getFormValue(); return date == null ? null : new org.tentackle.common.Date(date.getTime()); }
return new org.tentackle.common.Date(date.getTime());