Solved Test for a date is the same as a other date.

Discussion in 'Plugin Development' started by phil14052, Feb 14, 2016.

Thread Status:
Not open for further replies.
  1. Hi. I am trying to make a plugin. The plugin has a feature that it only can be used between two dates (Or just on one day). Can you do like that? So when (lets say christmas) then it will enable the feature.

    I don't know if you can do this.

    Thanks in advanced.

    Sorry for my bad english. :D
     
  2. @phil14052
    You can check the current date using Calendar class. For example, if you want to check if the day is 24th of December, check if the month is DECEMBER by using Calendar.get(Calendar.MONTH) and compare that to Calendar.DECEMBER. Same thing for the day.
    Code:
    Calendar calendar = Calendar.getInstance();
    int month = calendar.get(Calendar.MONTH);
    int day = calendar.get(Calendar.DAY_OF_MONTH);
    
    if(month == Calendar.DECEMBER && day == 24) {
        // christmas
    }
    Written on phone so may not be 100% correct.
     
  3. Thank you! This what just what i wanted. :D
     
Thread Status:
Not open for further replies.

Share This Page