java - DateFormat conversion in Android -


let suppose have date show as.

2015-08-03 12:00:00 

how convert day's name tuesday ? don't want things 03 tue etc. full days name. looked around bit confused on that.

first, parse date java.util.date object.

dateformat formatter = new simpledateformat("yyyy-mm-dd hh:mm:ss"); date yourdate = formatter.parse("2015-08-03 12:00:00"); 

then, populate calendar date:

calendar c = calendar.getinstance(); c.settime(yourdate); int dayofweek = c.get(calendar.day_of_week); 

now have day of week dayofweek (1 being sunday, example).


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -