This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push: new 66d7e35 Sort members. 66d7e35 is described below commit 66d7e35866379448faec58071faa1bc5f1fd4949 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Mar 7 15:18:07 2022 -0500 Sort members. --- .../apache/commons/lang3/time/DateFormatUtils.java | 192 ++++++++++----------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java b/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java index 820a6b3..e9e7200 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java @@ -203,60 +203,62 @@ public class DateFormatUtils { } /** - * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> - * - * @param millis the date to format expressed in milliseconds - * @param pattern the pattern to use to format the date, not null - * @return the formatted date - */ - public static String formatUTC(final long millis, final String pattern) { - return format(new Date(millis), pattern, UTC_TIME_ZONE, null); - } - - /** - * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> + * <p>Formats a calendar into a specific pattern. The TimeZone from the calendar + * will be used for formatting.</p> * - * @param date the date to format, not null - * @param pattern the pattern to use to format the date, not null - * @return the formatted date + * @param calendar the calendar to format, not null + * @param pattern the pattern to use to format the calendar, not null + * @return the formatted calendar + * @see FastDateFormat#format(Calendar) + * @since 2.4 */ - public static String formatUTC(final Date date, final String pattern) { - return format(date, pattern, UTC_TIME_ZONE, null); + public static String format(final Calendar calendar, final String pattern) { + return format(calendar, pattern, getTimeZone(calendar), null); } /** - * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> + * <p>Formats a calendar into a specific pattern in a locale. The TimeZone from the calendar + * will be used for formatting.</p> * - * @param millis the date to format expressed in milliseconds - * @param pattern the pattern to use to format the date, not null + * @param calendar the calendar to format, not null + * @param pattern the pattern to use to format the calendar, not null * @param locale the locale to use, may be {@code null} - * @return the formatted date + * @return the formatted calendar + * @see FastDateFormat#format(Calendar) + * @since 2.4 */ - public static String formatUTC(final long millis, final String pattern, final Locale locale) { - return format(new Date(millis), pattern, UTC_TIME_ZONE, locale); + public static String format(final Calendar calendar, final String pattern, final Locale locale) { + return format(calendar, pattern, getTimeZone(calendar), locale); } /** - * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> + * <p>Formats a calendar into a specific pattern in a time zone.</p> * - * @param date the date to format, not null - * @param pattern the pattern to use to format the date, not null - * @param locale the locale to use, may be {@code null} - * @return the formatted date + * @param calendar the calendar to format, not null + * @param pattern the pattern to use to format the calendar, not null + * @param timeZone the time zone to use, may be {@code null} + * @return the formatted calendar + * @see FastDateFormat#format(Calendar) + * @since 2.4 */ - public static String formatUTC(final Date date, final String pattern, final Locale locale) { - return format(date, pattern, UTC_TIME_ZONE, locale); + public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone) { + return format(calendar, pattern, timeZone, null); } /** - * <p>Formats a date/time into a specific pattern.</p> + * <p>Formats a calendar into a specific pattern in a time zone and locale.</p> * - * @param millis the date to format expressed in milliseconds - * @param pattern the pattern to use to format the date, not null - * @return the formatted date + * @param calendar the calendar to format, not null + * @param pattern the pattern to use to format the calendar, not null + * @param timeZone the time zone to use, may be {@code null} + * @param locale the locale to use, may be {@code null} + * @return the formatted calendar + * @see FastDateFormat#format(Calendar) + * @since 2.4 */ - public static String format(final long millis, final String pattern) { - return format(new Date(millis), pattern, null, null); + public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone, final Locale locale) { + final FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); + return df.format(calendar); } /** @@ -271,29 +273,15 @@ public class DateFormatUtils { } /** - * <p>Formats a calendar into a specific pattern. The TimeZone from the calendar - * will be used for formatting.</p> - * - * @param calendar the calendar to format, not null - * @param pattern the pattern to use to format the calendar, not null - * @return the formatted calendar - * @see FastDateFormat#format(Calendar) - * @since 2.4 - */ - public static String format(final Calendar calendar, final String pattern) { - return format(calendar, pattern, getTimeZone(calendar), null); - } - - /** - * <p>Formats a date/time into a specific pattern in a time zone.</p> + * <p>Formats a date/time into a specific pattern in a locale.</p> * - * @param millis the time expressed in milliseconds + * @param date the date to format, not null * @param pattern the pattern to use to format the date, not null - * @param timeZone the time zone to use, may be {@code null} + * @param locale the locale to use, may be {@code null} * @return the formatted date */ - public static String format(final long millis, final String pattern, final TimeZone timeZone) { - return format(new Date(millis), pattern, timeZone, null); + public static String format(final Date date, final String pattern, final Locale locale) { + return format(date, pattern, null, locale); } /** @@ -309,56 +297,52 @@ public class DateFormatUtils { } /** - * <p>Formats a calendar into a specific pattern in a time zone.</p> + * <p>Formats a date/time into a specific pattern in a time zone and locale.</p> * - * @param calendar the calendar to format, not null - * @param pattern the pattern to use to format the calendar, not null + * @param date the date to format, not null + * @param pattern the pattern to use to format the date, not null, not null * @param timeZone the time zone to use, may be {@code null} - * @return the formatted calendar - * @see FastDateFormat#format(Calendar) - * @since 2.4 + * @param locale the locale to use, may be {@code null} + * @return the formatted date */ - public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone) { - return format(calendar, pattern, timeZone, null); + public static String format(final Date date, final String pattern, final TimeZone timeZone, final Locale locale) { + final FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); + return df.format(date); } /** - * <p>Formats a date/time into a specific pattern in a locale.</p> + * <p>Formats a date/time into a specific pattern.</p> * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date, not null - * @param locale the locale to use, may be {@code null} * @return the formatted date */ - public static String format(final long millis, final String pattern, final Locale locale) { - return format(new Date(millis), pattern, null, locale); + public static String format(final long millis, final String pattern) { + return format(new Date(millis), pattern, null, null); } /** * <p>Formats a date/time into a specific pattern in a locale.</p> * - * @param date the date to format, not null + * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date, not null * @param locale the locale to use, may be {@code null} * @return the formatted date */ - public static String format(final Date date, final String pattern, final Locale locale) { - return format(date, pattern, null, locale); + public static String format(final long millis, final String pattern, final Locale locale) { + return format(new Date(millis), pattern, null, locale); } /** - * <p>Formats a calendar into a specific pattern in a locale. The TimeZone from the calendar - * will be used for formatting.</p> + * <p>Formats a date/time into a specific pattern in a time zone.</p> * - * @param calendar the calendar to format, not null - * @param pattern the pattern to use to format the calendar, not null - * @param locale the locale to use, may be {@code null} - * @return the formatted calendar - * @see FastDateFormat#format(Calendar) - * @since 2.4 + * @param millis the time expressed in milliseconds + * @param pattern the pattern to use to format the date, not null + * @param timeZone the time zone to use, may be {@code null} + * @return the formatted date */ - public static String format(final Calendar calendar, final String pattern, final Locale locale) { - return format(calendar, pattern, getTimeZone(calendar), locale); + public static String format(final long millis, final String pattern, final TimeZone timeZone) { + return format(new Date(millis), pattern, timeZone, null); } /** @@ -375,33 +359,49 @@ public class DateFormatUtils { } /** - * <p>Formats a date/time into a specific pattern in a time zone and locale.</p> + * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> * * @param date the date to format, not null - * @param pattern the pattern to use to format the date, not null, not null - * @param timeZone the time zone to use, may be {@code null} + * @param pattern the pattern to use to format the date, not null + * @return the formatted date + */ + public static String formatUTC(final Date date, final String pattern) { + return format(date, pattern, UTC_TIME_ZONE, null); + } + + /** + * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> + * + * @param date the date to format, not null + * @param pattern the pattern to use to format the date, not null * @param locale the locale to use, may be {@code null} * @return the formatted date */ - public static String format(final Date date, final String pattern, final TimeZone timeZone, final Locale locale) { - final FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); - return df.format(date); + public static String formatUTC(final Date date, final String pattern, final Locale locale) { + return format(date, pattern, UTC_TIME_ZONE, locale); } /** - * <p>Formats a calendar into a specific pattern in a time zone and locale.</p> + * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> * - * @param calendar the calendar to format, not null - * @param pattern the pattern to use to format the calendar, not null - * @param timeZone the time zone to use, may be {@code null} + * @param millis the date to format expressed in milliseconds + * @param pattern the pattern to use to format the date, not null + * @return the formatted date + */ + public static String formatUTC(final long millis, final String pattern) { + return format(new Date(millis), pattern, UTC_TIME_ZONE, null); + } + + /** + * <p>Formats a date/time into a specific pattern using the UTC time zone.</p> + * + * @param millis the date to format expressed in milliseconds + * @param pattern the pattern to use to format the date, not null * @param locale the locale to use, may be {@code null} - * @return the formatted calendar - * @see FastDateFormat#format(Calendar) - * @since 2.4 + * @return the formatted date */ - public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone, final Locale locale) { - final FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); - return df.format(calendar); + public static String formatUTC(final long millis, final String pattern, final Locale locale) { + return format(new Date(millis), pattern, UTC_TIME_ZONE, locale); } private static TimeZone getTimeZone(final Calendar calendar) {