android - Change date format of a stored date value in a database? -


i have database stores value in yyyy-mm-dd hh:mm:ss format.

when retrieve values, want them displayed in dd-mm-yyyy hh:mm am/pm format. cannot change way store them in first place.

i using cursor results database , add them list, used listadapter populate listview.

since cursor returns string how can change format of returned value?

you can use simpledateformat pattern "dd-mm-yyyy hh:mm a".

date mdate= new date(system.currenttimemillis()); simpledateformat mdateformat= new simpledateformat("dd-mm-yyyy hh:mm a"); system.out.println(mdateformat.format(mdate)); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -