Can somebody find what is wrong with this code. I am trying to convert the Date Time value to Long using the Date and Time Stamp.These two always returns two different values for the same date time.
String date = "2016-01-08 06:23:13.0";
if(date.lastIndexOf('.') != -1)
{
date = date.substring(0,date.lastIndexOf('.'));
date = date+"+0000";
}
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
Date myDate = fmt.parse(date);
System.out.println(myDate);
long timestamp = myDate.getTime();
System.out.println("The time stamp value is " + timestamp);
Timestamp tm = Timestamp.valueOf("2016-01-08 06:23:13.0");
System.out.println("The time stamp value using Timestamp is " + tm.getTime());