Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

import java.util.Date;

public class Main {

    public static boolean isToday(Date thisDate) {
        String today = getFormatDateTimeDesc(System.currentTimeMillis());
        String thisDateCal = getFormatDateTimeDesc(thisDate.getTime());
        if (today.substring(0, 10).endsWith(thisDateCal.substring(0, 10))) {
            return true;
        } else {
            return false;
        }
    }

    public static String getFormatDateTimeDesc(long longDate) {
        return new Timestamp(longDate).toString().substring(0, 19);
    }
}