Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.SimpleDateFormat;
- import java.util.GregorianCalendar;
- import java.util.Locale;
- public class tesdt {
- public static void main(String[] args) throws Exception{
- System.out.println(isDateOdd("JANUARY 2 2000"));
- }
- public static boolean isDateOdd(String date) throws Exception{
- SimpleDateFormat df = new SimpleDateFormat("MMMMM d yyyy", Locale.ENGLISH);
- GregorianCalendar calendar = new GregorianCalendar();
- calendar.setTime(df.parse(date));
- return calendar.get(GregorianCalendar.DAY_OF_YEAR) % 2 == 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement