Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 *   Copyright (c) 2014-2015 Luis M. Gallardo D.
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the GNU Lesser General Public License v3.0
 *   which accompanies this distribution, and is available at
 *   http://www.gnu.org/licenses/lgpl.html
 *
 */

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

public class Main {
    public static String unixTimestampToDate(String unixDate) {

        long dv = Long.valueOf(unixDate) * 1000;// its need to be in milisecond
        Date df = new Date(dv);
        String dateString = new SimpleDateFormat("yyyy-MM-dd hh:mm a").format(df);

        return dateString;
    }
}