I want to convert the current date to integer value. By default, it returns long. When I try to convert long to integer, and afterwards I convert the integer value to date, means it shows 1970's date,
int i = (int) new Date().getTime();
System.out.println("Integer : " + i);
System.out.println("Long : "+ new Date().getTime());
System.out.println("Long date : " + new Date(new Date().getTime()));
System.out.println("Int Date : " + new Date(i));
the output as follows:
Integer : 1292838124
Long : 1345617601771
Long date : Wed Aug 22 12:10:01 IST 2012
Int Date : Fri Jan 16 04:37:18 IST 1970
Any one please help me out, how to convert current date to integer(10 digit number)?
See Question&Answers more detail:os