Java Long Number to Time transformDateTime(long t)

Here you can find the source of transformDateTime(long t)

Description

transform Date Time

License

Apache License

Declaration

public static String transformDateTime(long t) 

Method Source Code

//package com.java2s;
/**/*from  ww  w. j av  a  2s.c o  m*/
 * Copyright 2013-2023 Xia Jun(3979434@qq.com).
 *
 * 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.
 *
 ***************************************************************************************
 *                                                                                     *
 *                        Website : http://www.farsunset.com                           *
 *                                                                                     *
 ***************************************************************************************
 */

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String transformDateTime(long t) {
        Date date = new Date(t);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(date);
    }
}

Related

  1. time2Date(Long time)
  2. time2DATETIME(long time)
  3. toLong(String time)
  4. toLongString(long ms)
  5. toTextTime(long time)