Java: Get week number from any date?

后端 未结 8 1029
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 09:38

I have a small program that displays the current week from todays date, like this:

GregorianCalendar gc = new GregorianCalendar();
int day = 0;
gc.add(Calend         


        
8条回答
  •  抹茶落季
    2020-12-30 10:06

    You can use that, but you have to parse the date value to proper date format using SimpleDateFormatter of java API. You can specify any format you want. After that you can do you manipulation to get the week of the year.

提交回复
热议问题