Java SQL Time Calculate getMonth(String dateTime)

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

Description

get Month

License

Apache License

Declaration

public static int getMonth(String dateTime) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static int getMonth(String dateTime) {
        Calendar c = Calendar.getInstance();
        c.setTime(getDateTime(dateTime));
        int month = c.get(2) + 1;
        return month;
    }/*w w w  .  java  2  s  .  c o  m*/

    public static java.util.Date getDateTime(String dateTime) {
        java.util.Date strDate = java.sql.Date.valueOf(dateTime);
        return strDate;
    }
}

Related

  1. getDiffTime(String _fromDate, String _fromTime, String _toDate, String _toTime)
  2. getExpiresTime(Long validityPeriod)
  3. getMidNightTime()
  4. getMinute(Time time)
  5. getMonth(String dateTime)
  6. getNewFileList(String path, String mintime)
  7. getNextDateTimeStr(String format)
  8. getNurseCoverageEndTime(Time startTime, Time shiftLength)
  9. getPreviousDateTimeString(String format)