简体   繁体   中英

Calendar methods doesn't work on netbeans

I'm trying to use some methods that should work in a Calendar, for example :

public void calculaSemanal(){
          CoffeeCalendar coffeeCalendar = CoffeeCalendar.getInstance();
        int week = coffeeCalendar.get(CoffeeCalendar.WEEK_OF_MONTH);
                }

but "create method getInstance()"appears; obs: i have java.util.Calendar imported, JDK version 1.8

Not sure what you're after with CoffeeCalendar, but the java.util.Calendar package does what your code is trying to do:

Calendar c = Calendar.getInstance();
int week = c.get(Calendar.WEEK_OF_MONTH);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM