diff --git a/src/java.base/share/classes/java/text/DateFormat.java b/src/java.base/share/classes/java/text/DateFormat.java index 2750e266729..47b7fd55565 100644 --- a/src/java.base/share/classes/java/text/DateFormat.java +++ b/src/java.base/share/classes/java/text/DateFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,28 +74,28 @@ import sun.util.locale.provider.LocaleServiceProviderPool; *
To format a date for the current Locale, use one of the * static factory methods: *
- **{@code + * {@snippet lang=java : * myString = DateFormat.getDateInstance().format(myDate); - * }+ * } *
If you are formatting multiple dates, it is * more efficient to get the format and use it multiple times so that * the system doesn't have to fetch the information about the local * language and country conventions multiple times. *
- **{@code + * {@snippet lang=java : * DateFormat df = DateFormat.getDateInstance(); * for (int i = 0; i < myDate.length; ++i) { * output.println(df.format(myDate[i]) + "; "); * } - * }+ * } *
To format a date for a different Locale, specify it in the * call to {@link #getDateInstance(int, Locale) getDateInstance()}. *
- ** *{@code + * {@snippet lang=java : * DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE); - * }+ * } *
If the specified locale contains "ca" (calendar), "rg" (region override), @@ -106,9 +106,9 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * *
You can use a DateFormat to parse also. *
- **{@code + * {@snippet lang=java : * myDate = df.parse(myString); - * }+ * } *
Use {@code getDateInstance} to get the normal date format for that country. * There are other static factory methods available. @@ -697,9 +697,9 @@ public abstract class DateFormat extends Format { /** * Sets the time zone for the calendar of this {@code DateFormat} object. * This method is equivalent to the following call. - *
+ *{@code - * getCalendar().setTimeZone(zone) - * }
{@snippet lang=java : + * getCalendar().setTimeZone(zone); + * }* *
The {@code TimeZone} set by this method is overwritten by a * {@link #setCalendar(java.util.Calendar) setCalendar} call. @@ -717,9 +717,9 @@ public abstract class DateFormat extends Format { /** * Gets the time zone. * This method is equivalent to the following call. - *
+ *{@code - * getCalendar().getTimeZone() - * }
{@snippet lang=java : + * getCalendar().getTimeZone(); + * }* * @return the time zone associated with the calendar of DateFormat. */ @@ -735,9 +735,9 @@ public abstract class DateFormat extends Format { * inputs must match this object's format. * *
This method is equivalent to the following call. - *
+ *{@code - * getCalendar().setLenient(lenient) - * }
{@snippet lang=java : + * getCalendar().setLenient(lenient); + * }* *
This leniency value is overwritten by a call to {@link * #setCalendar(java.util.Calendar) setCalendar()}. @@ -753,9 +753,9 @@ public abstract class DateFormat extends Format { /** * Tell whether date/time parsing is to be lenient. * This method is equivalent to the following call. - *
+ *{@code - * getCalendar().isLenient() - * }
{@snippet lang=java : + * getCalendar().isLenient(); + * }* * @return {@code true} if the {@link #calendar} is lenient; * {@code false} otherwise.