Java Parse Date parseDate(Long date, String format)

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

Description

parse Date

License

Open Source License

Declaration

public static Date parseDate(Long date, String format) 

Method Source Code

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

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

import java.util.Date;

import java.util.Locale;

public class Main {
    public static Date parseDate(Long date, String format) {
        if (date == null) {
            return null;
        }/*from   w ww  .j a va2  s.c  o m*/
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA);
        try {
            return simpleDateFormat.parse(date + "");
        } catch (ParseException e) {
            return null;
        }
    }

    public static Date parseDate(String date, String format) {
        if (date == null) {
            return null;
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA);
        try {
            return simpleDateFormat.parse(date + "");
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. parseDate(final String source)
  2. parseDate(final String source)
  3. parseDate(final String str)
  4. parseDate(final String str, final Locale locale, final String... parsePatterns)
  5. parseDate(final String value)
  6. parseDate(Map obj, String field, String format)
  7. parseDate(Object o)
  8. parseDate(Object str)
  9. parseDate(Object val)