Java Date Now getCurrentMonthday()

Here you can find the source of getCurrentMonthday()

Description

get Current Monthday

License

Open Source License

Declaration


public static List<String> getCurrentMonthday() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;

import java.util.List;

public class Main {
    /** //from w  w w  . j  a v  a  2  s .c o m
    * @Title: getCurrentMonthday 
    * @Description: TODO
    * @author alterhu2020@gmail.com
    * @param @return    
    * @return List<String>    return type
    * @throws 
    */

    public static List<String> getCurrentMonthday() {
        List<String> currentmonth = new ArrayList<String>();
        Calendar c = Calendar.getInstance();
        int totalday = c.getActualMaximum(Calendar.DAY_OF_MONTH);
        System.out.println("current month total day is :" + totalday);
        c.set(Calendar.DAY_OF_MONTH, 1);
        System.out.println("first day is :" + new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()));
        //currentmonth.add(new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()));
        for (int index = 1; index <= totalday; index++) {
            c.set(Calendar.DAY_OF_MONTH, index);
            currentmonth.add(new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()));
        }
        return currentmonth;
    }
}

Related

  1. getCurrentMinutes()
  2. getCurrentMonth()
  3. getCurrentMonth()
  4. getCurrentMonth()
  5. getCurrentMonth(boolean bool, String currentDate)
  6. getCurrentMonthLastDay()
  7. getCurrentMonthStartTime()
  8. getCurrentMonthString(Calendar calendar)
  9. getCurrentODSDate()