Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.DateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**
     * The snapped start how long
     * 
     * @param startTime
     * @param currentTime
     * @return
     */
    public static boolean isStart(String startTime, String currentTime) {
        Date current = null;
        Date start = null;
        try {
            DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            current = format.parse(currentTime);
            start = format.parse(startTime);
        } catch (ParseException e) {
            return false;
        }

        if (current != null && start != null) {
            return current.after(start);
        }

        return false;
    }
}