I tried very had to parse the string to date by dateformatter, the format of the string is like this --- 2018-06-02T00:00:00+11:00 and I want to parse it to Date type.
so I wrote like this
public Resident(String address, String dob, String email, String postcode, String firstname, String surname, String provider, String familynumber)
this.address = address;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
try{
dob = dob + "T00:00:00+11:00";//the dob is a string of "2018-06-02"
this.dob = sdf.parse(dob);
sdf.format(this.dob);
}
catch (ParseException e) {
e.printStackTrace();
}
...
however,as shown above, it generates*-- Fri Jun 01 23:00:00 GMT+10:00 2018* to me, the sequence is totally wrong, I tried numbers of way to debug but in vain.
Can someone tell me what is gone wrong??
many thanks!