when I run the following code:
package testframe;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class dates {
public static void handleLastValueDate() {
Timestamp stamp = new Timestamp(1490018838);
Date date = new Date(stamp.getTime());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
}
public static void main(String[] args) {
handleLastValueDate();
}
}
I get the following result: 1970-01-18 07:53
which is incorrect and should be
GMT: Mon, 20 Mar 2017 12:55:38 GMT
Your time zone: 3/20/2017, 2:55:38 PM GMT+2:00
can anyone please explain for me why this is happening? I tired to play with locale but also that didn't help! how can I see the correct time?
thanks.