Saturday, 15 May 2010

java - Format string containing date -



java - Format string containing date -

i receive string server contains date in format (2014-06-04 10:26:06).

i want convert date , apply date format it

simpledateformat longdateformat = new simpledateformat("dd mmmm yyyy");

this have @ moment, not working.

string formatteddate = longdateformat.format(messagegson.getcreated()); viewholder.textviewmessagedate.settext(formatteddate);

i cant seem find solution, think im missing a step there

try this..

1) parse() string date

2) format() date string

string formatteddate = longdateformat.format(new simpledateformat("yyyy-mm-dd hh:mm:ss").parse(messagegson.getcreated())); viewholder.textviewmessagedate.settext(formatteddate);

java android date datetime simpledateformat

No comments:

Post a Comment