@Test public void parseDate() throws Exception { final String result = DateTimeService.parseDate("Wed, Jul 4, '01", "EEE, MMM d, ''yy", "en", "US", "yyyy-MM-dd", "fr", "FR"); assertFalse(result.isEmpty()); assertEquals(result, "2001-07-04"); }
public static String parseDate(final String date, final String dateFormat, final String dateLocaleLang, final String dateLocaleCountry, final String outFormat, final String outLocaleLang, final String outLocaleCountry) throws Exception { if (StringUtils.isBlank(date)) { throw new RuntimeException(Constants.ErrorMessages.DATE_NULL_OR_EMPTY); } DateTimeZone timeZone = DateTimeZone.forID(Constants.Miscellaneous.GMT); DateTime inputDateTime = parseInputDate(date, dateFormat, dateLocaleLang, dateLocaleCountry, timeZone); return changeFormatForDateTime(inputDateTime, outFormat, outLocaleLang, outLocaleCountry); }
DateTimeService { public static String parseDate(final String date, final String dateFormat, final String dateLocaleLang, final String dateLocaleCountry, final String outFormat, final String outLocaleLang, final String outLocaleCountry) throws Exception { if (StringUtils.isBlank(date)) { throw new RuntimeException(Constants.ErrorMessages.DATE_NULL_OR_EMPTY); } DateTimeZone timeZone = DateTimeZone.forID(Constants.Miscellaneous.GMT); DateTime inputDateTime = parseInputDate(date, dateFormat, dateLocaleLang, dateLocaleCountry, timeZone); return changeFormatForDateTime(inputDateTime, outFormat, outLocaleLang, outLocaleCountry); } }
DateTimeService { public static String parseDate(final String date, final String dateFormat, final String dateLocaleLang, final String dateLocaleCountry, final String outFormat, final String outLocaleLang, final String outLocaleCountry) throws Exception { if (StringUtils.isBlank(date)) { throw new RuntimeException(Constants.ErrorMessages.DATE_NULL_OR_EMPTY); } DateTimeZone timeZone = DateTimeZone.forID(Constants.Miscellaneous.GMT); DateTime inputDateTime = parseInputDate(date, dateFormat, dateLocaleLang, dateLocaleCountry, timeZone); return changeFormatForDateTime(inputDateTime, outFormat, outLocaleLang, outLocaleCountry); }  }
DateTimeService { public static String parseDate(final String date, final String dateFormat, final String dateLocaleLang, final String dateLocaleCountry, final String outFormat, final String outLocaleLang, final String outLocaleCountry) throws Exception { if (StringUtils.isBlank(date)) { throw new RuntimeException(Constants.ErrorMessages.DATE_NULL_OR_EMPTY); } DateTimeZone timeZone = DateTimeZone.forID(Constants.Miscellaneous.GMT); DateTime inputDateTime = parseInputDate(date, dateFormat, dateLocaleLang, dateLocaleCountry, timeZone); return changeFormatForDateTime(inputDateTime, outFormat, outLocaleLang, outLocaleCountry); }  static String getCurrentDateTime(final String localeLang, final String localeCountry, final String timezone, final String dateFormat); static String parseDate(final String date, final String dateFormat, final String dateLocaleLang,
                                   final String dateLocaleCountry, final String outFormat, final String outLocaleLang,
                                   final String outLocaleCountry); static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry); }
DateTimeService { public static String parseDate(final String date, final String dateFormat, final String dateLocaleLang, final String dateLocaleCountry, final String outFormat, final String outLocaleLang, final String outLocaleCountry) throws Exception { if (StringUtils.isBlank(date)) { throw new RuntimeException(Constants.ErrorMessages.DATE_NULL_OR_EMPTY); } DateTimeZone timeZone = DateTimeZone.forID(Constants.Miscellaneous.GMT); DateTime inputDateTime = parseInputDate(date, dateFormat, dateLocaleLang, dateLocaleCountry, timeZone); return changeFormatForDateTime(inputDateTime, outFormat, outLocaleLang, outLocaleCountry); }  static String getCurrentDateTime(final String localeLang, final String localeCountry, final String timezone, final String dateFormat); static String parseDate(final String date, final String dateFormat, final String dateLocaleLang,
                                   final String dateLocaleCountry, final String outFormat, final String outLocaleLang,
                                   final String outLocaleCountry); static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry);  }