Java Long Number to Timestamp getCompactStringTimestamp(long timestamp)

Here you can find the source of getCompactStringTimestamp(long timestamp)

Description

get Compact String Timestamp

License

Open Source License

Declaration

public static String getCompactStringTimestamp(long timestamp) 

Method Source Code

//package com.java2s;
/* This file is part of VoltDB.
 * Copyright (C) 2008-2015 VoltDB Inc.//from w  w  w.  j  a  va  2  s  .c  o m
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getCompactStringTimestamp(long timestamp) {
        SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmss");
        Date tsDate = new Date(timestamp);
        return sdf.format(tsDate);
    }
}

Related

  1. addSecondsToTimeStamp(Long timestamp, int seconds)
  2. getIndex(String index, long timestamp)
  3. longToDate(long timestamp)
  4. longToDateTime(long timestamp)
  5. longToDateTime(long timestamp)