3232import java .util .Calendar ;
3333import java .util .HashMap ;
3434import java .util .Iterator ;
35+ import java .util .Locale ;
3536import java .util .Map ;
3637import java .util .Random ;
3738import java .util .TimeZone ;
@@ -1422,12 +1423,11 @@ public static long parseDuration(String durationString, long timestamp) throws I
14221423 haveMinus = true ;
14231424 }
14241425
1425- PeriodFormatter periodFormatter = ISOPeriodFormat .standard ();
1426+ PeriodFormatter periodFormatter = ISOPeriodFormat .standard (). withLocale ( new Locale ( "UTC" )) ;
14261427 Period period = periodFormatter .parsePeriod (durationString );
14271428
1428- DateTime dt = new DateTime (timestamp * 1000 );
1429- dt .toDateTime (DateTimeZone .UTC );
1430-
1429+ DateTime dt = new DateTime (timestamp * 1000 , DateTimeZone .UTC );
1430+
14311431 DateTime result = null ;
14321432 if (haveMinus ) {
14331433 result = dt .minus (period );
@@ -1441,8 +1441,7 @@ public static long parseDuration(String durationString, long timestamp) throws I
14411441 * @return the unix timestamp that matches the current time.
14421442 */
14431443 public static Long getCurrentTimeStamp () {
1444- DateTime currentDate = new DateTime ();
1445- currentDate .toDateTime (DateTimeZone .UTC );
1444+ DateTime currentDate = new DateTime (DateTimeZone .UTC );
14461445 return currentDate .getMillis () / 1000 ;
14471446 }
14481447
@@ -1538,6 +1537,7 @@ public static String formatDateTime(long timeInMillis, boolean millis) {
15381537 * @return datetime
15391538 */
15401539 public static DateTime parseDateTime (String dateTime ) {
1540+
15411541 DateTime parsedData = null ;
15421542 try {
15431543 parsedData = DATE_TIME_FORMAT .parseDateTime (dateTime );
0 commit comments