fork(8) download
  1. import java.text.ParseException;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4.  
  5. class Test {
  6. public static void main(String[] args) {
  7. String input = "Mon Sep 25 13:40:56 GMT+05:30 2017";
  8. String dateFormat = "EEE MMM d HH:mm:ss z yyyy";
  9. try {
  10. Date date = new SimpleDateFormat(dateFormat).parse(input);
  11. System.out.println(date);
  12. } catch (ParseException e) {
  13. e.printStackTrace();
  14. }
  15.  
  16. }
  17. }
  18.  
  19.  
Success #stdin #stdout 0.07s 4386816KB
stdin
Standard input is empty
stdout
Mon Sep 25 08:10:56 GMT 2017