Java Time Format tryToParse(String datetime, SimpleDateFormat format)

Here you can find the source of tryToParse(String datetime, SimpleDateFormat format)

Description

try To Parse

License

Apache License

Declaration

private static Date tryToParse(String datetime, SimpleDateFormat format) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static Date tryToParse(String datetime, SimpleDateFormat format) {
        try {/*from   w w  w . j a  va2 s.com*/
            return format.parse(datetime);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. toSQLDateTimeFormat(Calendar cal)
  2. toString(Date time, String format)
  3. toString(String format, long time)
  4. toString(String format, long time)
  5. toStringFormatTime(long time, String format)
  6. validateDatetimeString(String datetimeString, String format)