Following code is working fine in my java application. But when I am making the same application for Android using java it’s showing error “The constructor Timestamp(long) is undefined” in the following bold line “Timestamp rtnTS = new Timestamp(theDate.getTime());“
public static Timestamp createTimeStamp(String strTime, String strFormat) throws Exception
{
strTime = strTime.trim();
SimpleDateFormat formatter = new SimpleDateFormat(strFormat);
java.util.Date theDate = new java.util.Date();
theDate = (java.util.Date) formatter.parse(strTime);
**Timestamp rtnTS = new Timestamp(theDate.getTime());**
return rtnTS;
}
Anyone please help to sortout this issue.
Have you imported these.
Use like this.
Read from here http://developer.android.com/reference/java/sql/Timestamp.html