I want to convert the format from "yyyyMMdd" to "ccyyMMdd" simpledateformat in java. I am getting "c" as illegal character in java. Please help me to find the slution to convert in to "ccyyMMdd" format in java Simpledateformat
What is the differnce betwen "cc" and "yy" in java?
The
SimpleDateFormatdoesn't supportcforCentury. But if you simply want a 4digit year, you can useyyyyYou can find the full list supported on the official doc of
SimpleDateFormatAs pointed, you should also switch to the new Java Date/Time API but you will find the same problem,
DateTimeFormatterdoesn't have any "century" feature.