Java Date Create objectToDate(Object Obj)

Here you can find the source of objectToDate(Object Obj)

Description

object To Date

License

Open Source License

Declaration

public static Date objectToDate(Object Obj) 

Method Source Code

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

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

public class Main {
    public static Date objectToDate(Object Obj) {
        SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy-MM-dd");
        Date aux = null;/*from  w w  w .j a v  a 2 s . c o  m*/
        try {
            aux = formatoDelTexto.parse(objectToString(Obj));
        } catch (Exception ex) {
        }
        return aux;
    }

    public static String objectToString(Object Obj) {
        String Str = "";
        if (Obj != null) {
            Str = Obj.toString();
        }
        return Str;
    }
}

Related

  1. date(int year, int month, int day)
  2. date(int year, int month, int day, int hour, int minute)
  3. date(int year, int month, int day, int hour, int minute, int second)
  4. longArrayTODateArray(long[] dates_s, SimpleDateFormat dateformat)
  5. longToDate(long time)
  6. timeToDate()
  7. toDate()
  8. toDate()
  9. toDate(Calendar date)