Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SimpleDateFormat formate date have bug!

User_1NNFGDec 28 2021 — edited Dec 28 2021
@Test
public void testDate(){

    SimpleDateFormat sdf = new SimpleDateFormat("YYYY_MM_dd");
    Date date = new Date();
    String logTableName = "logs_his_" + sdf.format(date);
    System.out.println("logTableName is "+logTableName);
}

run this program ,the result below like this
logTableName is logs_his_2022_12_28
is seems not correct ,any one who can fix this problem ?

Comments
Post Details
Added on Dec 28 2021
3 comments
359 views