java - Converting string to readable SimpleDateFormat -
i trying add spaces string can use simpledateformat
. need add spaces this:
string str = "wed 3jun15 03:22:15 pm"
i know how put simpledateformat
format:
string str = "wed 3 jun 15 03:22:15 pm"
eventually trying pull d, hh:mm
out of date, rest can trashed.
i have looked @ link: how split string between letters , digits (or between digits , letters)? , while closed, doesn't work trying do.
this pattern should match string:
eee dmmmyy hh:mm:ss
with example:
string str = "wed 3jun15 03:22:15 pm"; simpledateformat fmt = new simpledateformat("eee ddmmmyy hh:mm:ss a"); date d = fmt.parse(str); simpledateformat output = new simpledateformat("d, hh:mm"); system.out.println(output.format(d)); //prints 3, 15:22
Comments
Post a Comment