Java Date Create toDate(Object object)

Here you can find the source of toDate(Object object)

Description

to Date

License

Open Source License

Declaration


public static Date toDate(Object object) 

Method Source Code


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

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

import java.util.Date;

public class Main {

    public static Date toDate(Object object) {

        String in = object.toString();

        Date date;/*from  w  w  w  .  j a  va2 s  . c  o  m*/

        DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
        try {
            date = formater.parse(in);
            return date;
        } catch (ParseException e) {
            return null;
        }

    }
}

Related

  1. toDate(long segundos)
  2. toDate(long time)
  3. toDate(long time)
  4. toDate(Object o)
  5. ToDate(Object o)
  6. toDate(Object value)
  7. toDateFormat(Date date)
  8. toDateFromLong(Long time)
  9. toDateHeader(long value)