Java Long Number to Date convert2long(String date, String format)

Here you can find the source of convert2long(String date, String format)

Description

convertlong

License

Apache License

Declaration

public static long convert2long(String date, String format) 

Method Source Code


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

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

public class Main {
    public static long convert2long(String date, String format) {
        try {//from w ww. j  a v  a  2  s  .  c o m
            SimpleDateFormat sf = new SimpleDateFormat(format);
            return sf.parse(date).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return 0l;
    }
}

Related

  1. convert(long number)
  2. convert(long time)
  3. convert(long value, double[] factors, String[] unites)
  4. convert(Long[] targets)
  5. convertDate(long datenum)
  6. convertDate(long millisecs)
  7. convertDate(long timestamp)
  8. convertDate(Long uTime, SimpleDateFormat dateFormat)