I have two strings which are pointing at the same time:
"2018-07-18 12:00:09+0000"
AND
"2018-07-18 15:00:09+0300"
I am receiving them from backend. The problem is that when I try to parse them I get different date objects:
public class Main {
private static SimpleDateFormat FORMAT;
public static void main(String[] args) {
String PATTERN = "yyyy-MM-dd hh:mm:ssX";
FORMAT = new SimpleDateFormat(PATTERN, Locale.US);
System.out.println(parseDate("2018-07-18 12:00:09+0000"));
System.out.println(parseDate("2018-07-18 15:00:09+0300"));
}
private static Date parseDate(String source) {
try {
return FORMAT.parse(source);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
}
Output:
Tue Jul 17 19:00:09 EST 2018
Wed Jul 18 07:00:09 EST 2018
I am really stuck.