datetime - GMT+ string convert to Date Java -


i trying convert string in format of "wed jun 01 00:00:00 gmt-400 2016" iso8601 "2016-06-01t00:00:00.000z". getting error "unparseable date". not sure doing wrong.

    dateformat startdate = new simpledateformat("eee mmm dd hh:mm:ss 'gmt'z yyyy", locale.us);     startdate.settimezone(timezone.gettimezone("etc/utc"));      simpledateformat formatter = new simpledateformat("yyyy-mm-dd't'hh:mm'z'", locale.us);     formatter.settimezone(timezone.gettimezone("etc/utc"));      date aparseddate = null;     try {         // give date in format         aparseddate = (date) startdate.parse(inputdateasstring);         system.out.println(aparseddate.tostring());          // convert date iso8601         string nowasiso = formatter.format(aparseddate);         system.out.println("iso date = " + nowasiso);         return nowasiso;      } catch (parseexception e) {         e.printstacktrace();     } 


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -