Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static String convertTime(int fetchDate, SimpleDateFormat sdf) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date((long) fetchDate * 1000));
        return sdf.format(cal.getTime());
    }

    public static Calendar convertTime(int fetchDate) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date((long) fetchDate * 1000));
        return cal;
    }
}