2323import java .text .ParseException ;
2424import java .text .SimpleDateFormat ;
2525import java .util .Date ;
26+ import java .util .Locale ;
2627import java .util .TimeZone ;
2728
2829final class RemoteConfigUtil {
@@ -53,15 +54,15 @@ static long convertToMilliseconds(String dateString) throws ParseException {
5354 static String convertToUtcZuluFormat (long millis ) {
5455 // sample output date string: 2020-11-12T22:12:02.000000000Z
5556 checkArgument (millis >= 0 , "Milliseconds duration must not be negative" );
56- SimpleDateFormat dateFormat = new SimpleDateFormat (ZULU_DATE_PATTERN );
57+ SimpleDateFormat dateFormat = new SimpleDateFormat (ZULU_DATE_PATTERN , Locale . ENGLISH );
5758 dateFormat .setTimeZone (UTC_TIME_ZONE );
5859 return dateFormat .format (new Date (millis ));
5960 }
6061
6162 static String convertToUtcDateFormat (long millis ) {
6263 // sample output date string: Tue, 08 Dec 2020 15:49:51 GMT
6364 checkArgument (millis >= 0 , "Milliseconds duration must not be negative" );
64- SimpleDateFormat dateFormat = new SimpleDateFormat (UTC_DATE_PATTERN );
65+ SimpleDateFormat dateFormat = new SimpleDateFormat (UTC_DATE_PATTERN , Locale . ENGLISH );
6566 dateFormat .setTimeZone (UTC_TIME_ZONE );
6667 return dateFormat .format (new Date (millis ));
6768 }
@@ -78,15 +79,16 @@ static long convertFromUtcZuluFormat(String dateString) throws ParseException {
7879 if (indexOfPeriod != -1 ) {
7980 dateString = dateString .substring (0 , indexOfPeriod );
8081 }
81- SimpleDateFormat dateFormat = new SimpleDateFormat (ZULU_DATE_NO_FRAC_SECS_PATTERN );
82+ SimpleDateFormat dateFormat =
83+ new SimpleDateFormat (ZULU_DATE_NO_FRAC_SECS_PATTERN , Locale .ENGLISH );
8284 dateFormat .setTimeZone (UTC_TIME_ZONE );
8385 return dateFormat .parse (dateString ).getTime ();
8486 }
8587
8688 static long convertFromUtcDateFormat (String dateString ) throws ParseException {
8789 // sample input date string: Tue, 08 Dec 2020 15:49:51 GMT
8890 checkArgument (!Strings .isNullOrEmpty (dateString ), "Date string must not be null or empty" );
89- SimpleDateFormat dateFormat = new SimpleDateFormat (UTC_DATE_PATTERN );
91+ SimpleDateFormat dateFormat = new SimpleDateFormat (UTC_DATE_PATTERN , Locale . ENGLISH );
9092 dateFormat .setTimeZone (UTC_TIME_ZONE );
9193 return dateFormat .parse (dateString ).getTime ();
9294 }
0 commit comments