Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static long HowLongAgo(String timestamp) {
        Long tempo;
        try {
            tempo = Long.parseLong(timestamp);
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }

        java.util.Date Now = new java.util.Date();

        long diff = (Now.getTime() - tempo);
        if (diff < 0)
            return 0;

        diff /= 1000;

        return diff;

    }
}