Java Month of Year getMonthOfYearFromTimestamp(long ms)

Here you can find the source of getMonthOfYearFromTimestamp(long ms)

Description

get Month Of Year From Timestamp

License

Open Source License

Declaration

public static int getMonthOfYearFromTimestamp(long ms) throws NumberFormatException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;

public class Main {
    public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC");
    public static final Locale LOCALE = new Locale("sv", "SE");

    public static int getMonthOfYearFromTimestamp(long ms) throws NumberFormatException {
        if (ms < 0)
            throw new NumberFormatException("argument must be positive");
        Calendar cal = Calendar.getInstance(TIMEZONE, LOCALE);
        cal.setTimeInMillis(ms);/*www.  j  a  v  a2s  .  c o m*/
        return cal.get(Calendar.MONTH);
    }
}

Related

  1. getMonth(int week, int year)
  2. getMonthDays(Object year, Object month)
  3. getMonthHaveDays(int year, int month)
  4. getMonthOfYear(int m)
  5. getMonthOfYear(long time)
  6. getMonthStart(int year, int month)
  7. getNextiMonth(Date date, int month)
  8. getNextMonth()
  9. getNextMonth(Calendar aCal)