I want to convert String to date object I used this code to convert
try{
SimpleDateFormat parse = new SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'");
String dateTime = "1996-10-7T4:50:00Z";
Date parsed = parse.parse(dateTime);
System.out.println("formatted: " + formatter.format(parsed));
}
catch(ParseException e){
System.out.println("Caught " + e);
}
output:
I need value of date object to be **1996-10-7T4:50:00Z** as it as the given string.
но код, указанный выше, создает объект даты: понедельник, окт. 07 04:50:00 PDT 1996