How to get Century from date in Java

前端 未结 5 932
孤独总比滥情好
孤独总比滥情好 2021-01-04 20:41

How to get current Century from a date in Java?

For example the date \"06/03/2011\" according to format \"MM/dd/yyyy\". How can I get curre

5条回答
  •  耶瑟儿~
    2021-01-04 21:33

    I dont know anything about Java but why don't you just get the full year and make the last 2 digits 0?

    EDIT

    If you want 2011 to become 21st century - just get the fully qualified year in string format, then knock off the last 2 characters, then parse to an int and add 1!

提交回复
热议问题