SimpleDateFormat "W" default set SUNDAY is first day of week,ex:
SimpleDateFormat f = new SimpleDateFormat("W");
format.f(new Date());
i want to set "W" first day is MONDAY,i try:
SimpleDateFormat f = new SimpleDateFormat("W");
Calendar c=Calendar.getInstance();
c.setTimeInMillis(input);
c.setFirstDayOfWeek(Calendar.MONDAY);
format.format(c.getTime())
but no effect.
use setCalendar() on your SimpleDateFormat to set the calendar used for date calculations:
SimpleDateFormat format = new SimpleDateFormat("W");
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek( Calendar.MONDAY );
format.setCalendar( calendar );
format.format( whateverDateYouWantToFormat );`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With