Java Month Get getMonth(String startTime)

Here you can find the source of getMonth(String startTime)

Description

get Month

License

Open Source License

Declaration

public static int getMonth(String startTime) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public static int getMonth(String startTime) {
        int year = 0;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        try {/*from ww w. j a v a2s.c om*/
            year = sdf.parse(startTime).getMonth() + 1;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return year;
    }
}

Related

  1. getMonth(String f)
  2. getMonth(String name)
  3. getMonth(String pFormattedDate)
  4. getMonth(String quarters)
  5. getMonth(String sMonth)
  6. getMonth(String str_date)
  7. getMonth(String strDate)
  8. getMonth(String strDate)
  9. getMonth(String tempdat, Locale locale)