Java Date Format dateTimeToMillis(String dateTime, String format)

Here you can find the source of dateTimeToMillis(String dateTime, String format)

Description

date Time To Millis

License

LGPL

Declaration

public static long dateTimeToMillis(String dateTime, String format) 

Method Source Code

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

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

public class Main {

    public static long dateTimeToMillis(String dateTime, String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        try {//from w  w  w.j  a  v  a  2 s .co m
            return dateFormat.parse(dateTime).getTime();
        } catch (ParseException e) {
            return -1;
        }
    }
}

Related

  1. dateTime2String(Date value)
  2. dateTime2StringFs(Date date)
  3. dateTimeFormat(Date dateTime)
  4. DateTimeFormat(final Date date)
  5. dateTimeFormatterDate(Date date)
  6. dateTimeToStr(Date date, String format)
  7. dateTimeToZuluFormat(DateTime dateTime)
  8. formatD(Date date)
  9. formatDashedDateDDMMYYYY(Date date)