Java Unix time getUnixEpochDateTime()

Here you can find the source of getUnixEpochDateTime()

Description

Returns the starting Unix Epoch Time.

License

Microsoft Public License

Return

the Unix Epoch Time.

Declaration

public static Date getUnixEpochDateTime() 

Method Source Code

//package com.java2s;
/**//from w w w. j  a  va2s.co  m
 *
 * Licensed under the Microsoft Public License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *              http://opensource.org/licenses/MS-PL
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
**/

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

public class Main {
    /**
     * Returns the starting Unix Epoch Time.
     * @return the Unix Epoch Time.
     */
    public static Date getUnixEpochDateTime() {
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        calendar.set(1970, 0, 1, 0, 0, 0);
        return calendar.getTime();
    }
}

Related

  1. getUnixTime(Date date)
  2. getUnixTimeByDate(Date date)
  3. unix2afpTime(long ut)
  4. unixDateToString(int date)