Java SQL Date Create asDate(Object tsObj)

Here you can find the source of asDate(Object tsObj)

Description

as Date

License

Apache License

Declaration

private static Timestamp asDate(Object tsObj) 

Method Source Code

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

import java.sql.Timestamp;

public class Main {
    private static Timestamp asDate(Object tsObj) {
        if (tsObj != null) {
            long tsLong = (tsObj instanceof Number) ? ((Number) tsObj).longValue()
                    : Long.parseLong(tsObj.toString());
            return new Timestamp(tsLong);
        }//from  ww  w . j  ava 2  s.  co m
        return null;
    }
}

Related

  1. asDate(java.sql.Date sqlDate)
  2. asSqlDate(Date date)
  3. asSqlDate(Date date)
  4. asSqlDate(String date)
  5. beforeNow(final Date d)