/** * Sets the {@code DateFormatSymbols} used by this simple date format. * * @param value * the new {@code DateFormatSymbols} object. */ public void setDateFormatSymbols(DateFormatSymbols value) { formatData = (DateFormatSymbols) value.clone(); }
/** * Returns the {@code DateFormatSymbols} used by this simple date format. * * @return the {@code DateFormatSymbols} object. */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols) formatData.clone(); }
/** * Returns a new {@code SimpleDateFormat} with the same pattern and * properties as this simple date format. */ @Override public Object clone() { SimpleDateFormat clone = (SimpleDateFormat) super.clone(); clone.formatData = (DateFormatSymbols) formatData.clone(); clone.defaultCenturyStart = new Date(defaultCenturyStart.getTime()); return clone; }
/** * Constructs a new {@code SimpleDateFormat} using the specified * non-localized pattern and {@code DateFormatSymbols} and the {@code * Calendar} for the user's default locale. * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>". * * @param template * the pattern. * @param value * the DateFormatSymbols. * @throws NullPointerException * if the pattern is {@code null}. * @throws IllegalArgumentException * if the pattern is invalid. */ public SimpleDateFormat(String template, DateFormatSymbols value) { this(Locale.getDefault()); validatePattern(template); pattern = template; formatData = (DateFormatSymbols) value.clone(); }
import java.util.*; import java.text.*; public class Test { public static void main(String[] args) throws Exception { String text = "2013-05-23T09:18:07 p.m..380+0000"; String pattern = "yyyy-MM-dd'T'hh:mm:ss aa'.380+0000'"; SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.US); format.setTimeZone(TimeZone.getTimeZone("UTC")); DateFormatSymbols symbols = format.getDateFormatSymbols(); symbols = (DateFormatSymbols) symbols.clone(); symbols.setAmPmStrings(new String[] { "a.m.", "p.m."}); format.setDateFormatSymbols(symbols); Date date = format.parse(text); System.out.println(date); } }
/** * Sets the {@code DateFormatSymbols} used by this simple date format. * * @param value * the new {@code DateFormatSymbols} object. */ public void setDateFormatSymbols(DateFormatSymbols value) { formatData = (DateFormatSymbols) value.clone(); }
/** * Sets the date and time format symbols of this date format. * * @param newFormatSymbols the new date and time format symbols * @exception NullPointerException if the given newFormatSymbols is null * @see #getDateFormatSymbols */ public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { this.formatData = (DateFormatSymbols)newFormatSymbols.clone(); useDateFormatSymbols = true; }
/** * Returns the {@code DateFormatSymbols} used by this simple date format. * * @return the {@code DateFormatSymbols} object. */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols) formatData.clone(); }
/** * Sets the {@code DateFormatSymbols} used by this simple date format. * * @param value * the new {@code DateFormatSymbols} object. */ public void setDateFormatSymbols(DateFormatSymbols value) { formatData = (DateFormatSymbols) value.clone(); }
/** * Returns the {@code DateFormatSymbols} used by this simple date format. * * @return the {@code DateFormatSymbols} object. */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols) formatData.clone(); }
/** * Sets the {@code DateFormatSymbols} used by this simple date format. * * @param value * the new {@code DateFormatSymbols} object. */ public void setDateFormatSymbols(DateFormatSymbols value) { formatData = (DateFormatSymbols) value.clone(); }
/** * Returns the {@code DateFormatSymbols} used by this simple date format. * * @return the {@code DateFormatSymbols} object. */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols) formatData.clone(); }
/** * Returns the {@code DateFormatSymbols} used by this simple date format. * * @return the {@code DateFormatSymbols} object. */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols) formatData.clone(); }
/** * Gets a copy of the date and time format symbols of this date format. * * @return the date and time format symbols of this date format * @see #setDateFormatSymbols */ public DateFormatSymbols getDateFormatSymbols() { return (DateFormatSymbols)formatData.clone(); }
/** * Returns a new {@code SimpleDateFormat} with the same pattern and * properties as this simple date format. */ @Override public Object clone() { SimpleDateFormat clone = (SimpleDateFormat) super.clone(); clone.formatData = (DateFormatSymbols) formatData.clone(); clone.defaultCenturyStart = new Date(defaultCenturyStart.getTime()); return clone; }
/** * Returns a new {@code SimpleDateFormat} with the same pattern and * properties as this simple date format. */ @Override public Object clone() { SimpleDateFormat clone = (SimpleDateFormat) super.clone(); clone.formatData = (DateFormatSymbols) formatData.clone(); clone.defaultCenturyStart = new Date(defaultCenturyStart.getTime()); return clone; }
@Override public Object clone() { DateFormatSymbolsICU other = (DateFormatSymbolsICU)super.clone(); if (fIcuDfs != null) { // fIcuDfs must not be null except for premature instance. // A premature instance might be created by Java DateFormatSymbols' // internal cache. See #11733 for more details. other.fIcuDfs = (DateFormatSymbols)this.fIcuDfs.clone(); } return other; }
/** * Overrides clone. * @stable ICU 2.0 */ public Object clone() { return new DateFormatSymbols((java.text.DateFormatSymbols)dfs.clone()); }
/** * Returns a new {@code SimpleDateFormat} with the same pattern and * properties as this simple date format. */ @Override public Object clone() { SimpleDateFormat clone = (SimpleDateFormat) super.clone(); clone.formatData = (DateFormatSymbols) formatData.clone(); clone.defaultCenturyStart = new Date(defaultCenturyStart.getTime()); return clone; }
DateFormatSymbols englishSymbols = DateFormatSymbols.getInstance(Locale.ENGLISH); DateFormatSymbols mySymbols = (DateFormatSymbols)englishSymbols.clone(); String[] weekdays = mySymbols.getWeekdays(); weekdays[Calendar.SUNDAY] = "Sunnyday"; mySymbols.setWeekdays(weekdays); DateFormat f = new SimpleDateFormat("EEEE, dd MMM, yyyy", mySymbols); System.out.println(f.format(new Date()));