java - Calendar week_of_year comes week_of_month -
i retrieving number of week in year date seems returns me number of week in month.
calendar cal = calendar.getinstance(); try { cal.settime((new simpledateformat("yyyy-mm-dd")).parse(date)); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } int num_of_week = cal.get(calendar.week_of_year);
i input "2014-08-18" , comes out 3 result.......how can correctly retrieve week number.......
try this:
cal.settime((new simpledateformat("yyyy-mm-dd")).parse(date)); ^^---change month mm
instead of
cal.settime((new simpledateformat("yyyy-mm-dd")).parse(date));
Comments
Post a Comment