/** * Returns a formatted string representing the date returned by * {@link #getDate()}. In its default implementation, this method * allows you to retrieve the current date in standard formats by * simply doing things like <code>$date.medium</code> or * <code>$date.full</code>. If you want only the date or time portion * you can specify that along with the standard formats. (e.g. * <code>$date.medium_date</code> or <code>$date.short_time</code>) * More complex or custom formats can be retrieved * by using the full method syntax. (e.g. $date.get('E, MMMM d')) * * @param format the formatting instructions * @return a formatted representation of the date returned by * {@link #getDate()} * @see #format(String format, Object obj, Locale locale, TimeZone timezone) * @since VelocityTools 1.1 */ public String get(String format) { return format(format, getDate()); }
/** * @return the result of {@link #getDate()} formatted according to the result * of {@link #getFormat()}. * @see #format(String format, Object obj) */ public String toString() { return format(getFormat(), getDate()); }
/** * Returns a formatted string representing the date and/or time given by * {@link #getDate()} in standard, localized patterns. * * @param dateStyle the style pattern for the date * @param timeStyle the style pattern for the time * @return a formatted representation of the date returned by * {@link #getDate()} * @see DateFormat * @see #format(String dateStyle, String timeStyle, Object obj, Locale locale, TimeZone timezone) * @since VelocityTools 1.1 */ public String get(String dateStyle, String timeStyle) { return format(dateStyle, timeStyle, getDate(), getLocale()); }