java - Format current date to show day of the week -
this question has answer here:
i want show current date in application this: thu, may 2, 2013
i have following code current date
calendar c = calendar.getinstance(); time time = new time(); time.set(c.get(calendar.day_of_month), c.get(calendar.month), c.get(calendar.year));
how can format time object string need?
this want
calendar cal = calendar.getinstance(); simpledateformat sdf = new simpledateformat("eee, mmm d, yyyy"); string strdate = sdf.format(cal.gettime()); system.out.println("current date in string format: " + strdate);
where strdate can displayed in textview or whatever
Comments
Post a Comment