you are working on an application in which you want to convert date into Long or vise versa of the same, long intodate then use the below code.
using of long into date and date into long is depend on the code requirement or use of the programme.
explain you to convert date into long, I use in built function in it.
import java.util.Calendar;
import java.util.Date;
public class test {
public static void main(String[] args) {
Date dt=new Date(Long.valueOf(1390973400983L));
System.out.println(dt.toString());
Calendar cal=Calendar.getInstance();
cal.set(2014, Calendar.JANUARY, 29, 11, 00, 0);
System.out.println(cal.getTimeInMillis());
System.out.println();
}
}
using of long into date and date into long is depend on the code requirement or use of the programme.
explain you to convert date into long, I use in built function in it.
import java.util.Calendar;
import java.util.Date;
public class test {
public static void main(String[] args) {
Date dt=new Date(Long.valueOf(1390973400983L));
System.out.println(dt.toString());
Calendar cal=Calendar.getInstance();
cal.set(2014, Calendar.JANUARY, 29, 11, 00, 0);
System.out.println(cal.getTimeInMillis());
System.out.println();
}
}