Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static long dateStrToLong(String pattern, String strDate) {
        long date = 0;
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        try {
            Date t = sdf.parse(strDate);
            date = t.getTime();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return date;
    }
}