Traditional Culture Encyclopedia - Almanac inquiry - Java judges the start time and end time.
Java judges the start time and end time.
Java . text . simple date format SDF = new Java . text . simple date format(" yyyy-MM ");
Java . util . calendar star calendar = Java . util . calendar . getinstance();
Java . util . calendar end calendar = Java . util . calendar . getinstance();
string starStr = " 20 1 1- 1 1 ";
string endStr = " 20 12-02 ";
Java . util . date star date = SDF . parse(starStr);
Java . util . date end date = SDF . parse(endStr);
star calendar . settime(star date);
EndCalendar.setTime (end date);
int instance = end calendar . compare to(star calendar);
while(end calendar . compare to(star calendar)& gt; =0){
system . out . println(SDF . format(star calendar . gettime()));
//? I output here, you can handle it yourself, lists and so on.
StarCalendar.add (calendar. Month,1);
}
}catch(ParseException e){
e . printstacktrace();
}
- Previous article:Dream of the lottery before the game.
- Next article:【 auspicious day of the ecliptic 】 202111/9 Gregorian calendar query
- Related articles
- What's the best day to move in?
- What does miss shuzi's Mr. Red Bean mean?
- How many kinds of dragons are there? What's the difference? Be specific? There better be
- Will you worship the kitchen god on June 13, 2022?
- Can Dalian go fishing at the end of February?
- Is the 25th day of the twelfth lunar month in 2020 a good day to move?
- How old is Huang Li this year?
- What oil does the RV use?
- What do you mean, four dragons control water, one cow plows the field, three days win the prize, and eight people share the prize?
- 【 auspicious day of the zodiac 】 20 19 may 15 Gregorian calendar query