Java Date Parse convertTimeInMillisecondsToDate(long timeInMilliseconds)

Here you can find the source of convertTimeInMillisecondsToDate(long timeInMilliseconds)

Description

convert Time In Milliseconds To Date

License

Apache License

Parameter

Parameter Description
timeInMilliseconds a parameter

Return

the date provided by timeInMilliseconds in YYYY_MM_DD_HH_MM_SS format

Declaration

public static String convertTimeInMillisecondsToDate(long timeInMilliseconds) 

Method Source Code


//package com.java2s;
/*//from w ww. j  av  a2 s.  c  om
 *    Copyright 2016 Roche NimbleGen Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  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.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**
     * 
     * @param timeInMilliseconds
     * @return the date provided by timeInMilliseconds in YYYY_MM_DD_HH_MM_SS format
     */
    public static String convertTimeInMillisecondsToDate(long timeInMilliseconds) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date(timeInMilliseconds);
        return dateFormat.format(date);
    }
}

Related

  1. convertStrToDate(String dateStr, String dateFormat)
  2. convertStrToDate(String day)
  3. convertStrToDate(String s, String format)
  4. convertStrToDate(String source)
  5. convertTFormatToCDATime(String tDate)
  6. convertTimeStampToDate(String dateString, String srcFormat, String destFormat)
  7. convertTimestampToDateTime(Long timestamp, Boolean withSeconds)
  8. convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime)
  9. convertUTCDateToLocal(String sDate, TimeZone timezone)