Hi when i using this code for convert timestamp to date. but i do not know when i enter the date now year timestamp for get time it print 1970 year. can you help me?
this code i using :
Date a = new Date(1586822400);
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
String d = simpleDateFormat.format(date);
But:
Date date = new Date(1586822400L*1000L);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
String strDate = simpleDateFormat.format(date);
you need to convert unix seconds to milliseconds seconds by multiply 1000L;