Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parsing date and time in java

I have Time format in (yyyy-mm-ddTHH:mm+0:0000)..i need to convert this format to mm-dd-yyyy hh:mm am/pm using java program...any one help me to do this..thanx in advance...

like image 459
shiva2011 Avatar asked Dec 04 '22 23:12

shiva2011


1 Answers

Try something like this:

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm+s:SSSS");
Date date = format.parse(dateString);
format = new SimpleDateFormat("MM-dd-yyyy hh:mm a");
dateString = format.format(date);
like image 197
morja Avatar answered Dec 21 '22 23:12

morja