Java String to Time getMReportTime(String time)

Here you can find the source of getMReportTime(String time)

Description

get M Report Time

License

Apache License

Declaration

public static Date[] getMReportTime(String time) throws Exception 

Method Source Code

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

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

public class Main {
    public static Date[] getMReportTime(String time) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
        Date date = dateFormat.parse(time);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//from   w  ww. ja  v a 2  s  . com
        calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) + 1);
        calendar.set(Calendar.DAY_OF_MONTH, 0);
        Date[] dates = new Date[2];
        dates[1] = calendar.getTime();
        dates[0] = date;
        return dates;
    }
}

Related

  1. getEndTime(String flag, int value)
  2. getExecutionDateTime(String input)
  3. getExpireTime(String timeStr)
  4. getFormerDate(String dateTime)
  5. getIdByTime(String name)
  6. getSignTime(final String stStr)
  7. getStringWithTime(String str)
  8. getSystemTime(String pattern)
  9. getTime(String date)