Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {

    public static long date2millis(String pattern, String date) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        long millis = 0L;
        try {
            millis = sdf.parse(date).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return millis;
    }
}