I'm a beginner at Java I have a question about the new date

Asked 2 years ago, Updated 2 years ago, 71 views

If you enter aa=new Date (2019,19,39) If you look at the date, you can see 2020/9/8 I don't know why Help me

date

2022-09-22 14:38

1 Answers

Think common sense.

In Date, the month is from 0 to 11.

19 is a year and eight months mark. (11 + 8)

For the same reason, 39 is 31, which is the remaining 8 days of the month.

So it's one more year, and the rest of August, and the date is 31 years old, so it's +1 month and it's September.


2022-09-22 14:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.