Java TimeZone Get getTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second)

Here you can find the source of getTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second)

Description

get Time

License

Open Source License

Declaration

static public long getTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Whizzo Software, LLC.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

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

public class Main {
    static public long getTime(TimeZone tz, int year, int month, int day, int hour, int minute, int second) {
        Calendar c = Calendar.getInstance(tz);
        c.set(Calendar.YEAR, year);
        c.set(Calendar.MONTH, month - 1);
        c.set(Calendar.DAY_OF_MONTH, day);
        c.set(Calendar.HOUR_OF_DAY, hour);
        c.set(Calendar.MINUTE, minute);
        c.set(Calendar.SECOND, second);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTimeInMillis();
    }//w  ww  .  j a  v  a 2 s  .  co m
}

Related

  1. getRawOffset(String timeZoneStr)
  2. getRawOffsetDifference(TimeZone from, TimeZone to)
  3. getServerTimezoneOffset()
  4. getTime(boolean lenient, TimeZone tz, int year, int month, int day, int hour, int minute, int second, boolean setMillis, int nano)
  5. getTime(final String time, final TimeZone tz)
  6. getTime(TimeZone zone)
  7. getTimeAsPerTimeZone(String time, String timeZOne)
  8. getTimeInCurrentDay(long now, TimeZone tz, int hour, int minute, int second, int millisecond)
  9. getTimeTry(boolean lenient, TimeZone tz, int year, int month, int day, int hour, int minute, int second, int millis)