@Test public void offsetTimeBy() throws Exception { final String result = DateTimeService.offsetTimeBy("April 26, 2016 1:32:20 PM", "20", "en", "US"); DateTimeFormatter dateTimeFormatter = DateTimeUtils.getDateFormatter("dd-MM-yyyy HH:mm:ss", "en", "us"); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateTimeFormatter, result); assertFalse(result.isEmpty()); assertEquals(dateTimeFormatter.print(dateTime), "26-04-2016 13:32:40"); }
public static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry) throws Exception { Long parsedOffset = Long.parseLong(offset); if (DateTimeUtils.isUnix(localeLang)) { Long offsetTimestamp = Long.parseLong(date) + parsedOffset; return offsetTimestamp.toString(); } DateTimeFormatter dateFormatter = DateTimeUtils.formatWithDefault(localeLang, localeCountry); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateFormatter, date); return dateFormatter.print(dateTime.plusSeconds(parsedOffset.intValue())); }
DateTimeService { public static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry) throws Exception { Long parsedOffset = Long.parseLong(offset); if (DateTimeUtils.isUnix(localeLang)) { Long offsetTimestamp = Long.parseLong(date) + parsedOffset; return offsetTimestamp.toString(); } DateTimeFormatter dateFormatter = DateTimeUtils.formatWithDefault(localeLang, localeCountry); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateFormatter, date); return dateFormatter.print(dateTime.plusSeconds(parsedOffset.intValue())); } }
DateTimeService { public static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry) throws Exception { Long parsedOffset = Long.parseLong(offset); if (DateTimeUtils.isUnix(localeLang)) { Long offsetTimestamp = Long.parseLong(date) + parsedOffset; return offsetTimestamp.toString(); } DateTimeFormatter dateFormatter = DateTimeUtils.formatWithDefault(localeLang, localeCountry); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateFormatter, date); return dateFormatter.print(dateTime.plusSeconds(parsedOffset.intValue())); }  }
DateTimeService { public static String offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry) throws Exception { Long parsedOffset = Long.parseLong(offset); if (DateTimeUtils.isUnix(localeLang)) { Long offsetTimestamp = Long.parseLong(date) + parsedOffset; return offsetTimestamp.toString(); } DateTimeFormatter dateFormatter = DateTimeUtils.formatWithDefault(localeLang, localeCountry); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateFormatter, date); return dateFormatter.print(dateTime.plusSeconds(parsedOffset.intValue())); }  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 offsetTimeBy(final String date, final String offset, final String localeLang, final String localeCountry) throws Exception { Long parsedOffset = Long.parseLong(offset); if (DateTimeUtils.isUnix(localeLang)) { Long offsetTimestamp = Long.parseLong(date) + parsedOffset; return offsetTimestamp.toString(); } DateTimeFormatter dateFormatter = DateTimeUtils.formatWithDefault(localeLang, localeCountry); DateTime dateTime = DateTimeUtils.getJodaOrJavaDate(dateFormatter, date); return dateFormatter.print(dateTime.plusSeconds(parsedOffset.intValue())); }  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);  }