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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -