Java Date Convert convertDate(Object obj)

Here you can find the source of convertDate(Object obj)

Description

convert Date

License

Apache License

Declaration

private static Date convertDate(Object obj) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {
    private static Date convertDate(Object obj) {
        if (obj != null) {
            if (obj instanceof Calendar) {
                Calendar cal = (Calendar) obj;
                return cal.getTime();
            }/*from  w w  w.  j av  a2 s.  com*/
            if (obj instanceof Date) {
                return (Date) obj;
            }
        }
        return null;
    }
}

Related

  1. convert(Date d)
  2. convertDateTime(String date, String time)
  3. convertDateTimeToSysTime(String sDateTime)
  4. ConvertDateToAge(String date)
  5. convertDateToDoubleTime(Date time)