Java Date Now getCurrentMonth(boolean bool, String currentDate)

Here you can find the source of getCurrentMonth(boolean bool, String currentDate)

Description

get Current Month

License

Apache License

Declaration

public static String getCurrentMonth(boolean bool, String currentDate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getCurrentMonth(boolean bool, String currentDate) {
        Calendar date1 = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;/*ww w .  ja v a  2  s.c  o m*/
        try {
            date = sdf.parse(currentDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        date1.setTime(date);
        date1.set(Calendar.DATE, 1);

        if (bool) {

        } else {
            date1.add(Calendar.MONTH, 1);

        }

        return sdf.format(date1.getTime());
    }
}

Related

  1. getCurrentLocaleTime()
  2. getCurrentMinutes()
  3. getCurrentMonth()
  4. getCurrentMonth()
  5. getCurrentMonth()
  6. getCurrentMonthday()
  7. getCurrentMonthLastDay()
  8. getCurrentMonthStartTime()
  9. getCurrentMonthString(Calendar calendar)