Java Calendar Time newCalendar(final long time)

Here you can find the source of newCalendar(final long time)

Description

new Calendar

License

Open Source License

Declaration

public static Calendar newCalendar(final long time) 

Method Source Code


//package com.java2s;
/* Copyright (c) 2012 lib4j
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * You should have received a copy of The MIT License (MIT) along with this
 * program. If not, see <http://opensource.org/licenses/MIT/>.
 */// www .  j av  a 2  s.com

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

public class Main {
    public static Calendar newCalendar(final long time, final TimeZone timeZone) {
        if (timeZone == null)
            throw new IllegalArgumentException("timeZone == null");

        final Calendar calendar = Calendar.getInstance(timeZone);
        calendar.setTimeInMillis(time);
        return calendar;
    }

    public static Calendar newCalendar(final long time) {
        final Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(time);
        return calendar;
    }
}

Related

  1. isWorkTime(Calendar calendar, String workTimeStart, String workTimeEnd)
  2. maximizeTimeFields(final Calendar calendar)
  3. merge(Calendar date, Calendar time)
  4. mergeDateAndTime(final Calendar date, final Calendar time)
  5. mergeDateTime(Calendar date, Calendar time)
  6. newCalendarInstance(TimeZone timeZone)
  7. normalizeLocalTime(final Calendar cal)
  8. parseTime(Calendar calendar, String time_string)
  9. parseTime(String time, Calendar calendar)