S
Sameer
import java.util.*;
import java.text.*;
public class DateDemo1 {
public static void main(String args[]) throws ParseException {
Calendar cal = Calendar.getInstance();
cal.set(2006,7,1);
Date date = cal.getTime();
long longTime = date.getTime();
System.out.println("Long representation of date:"+longTime);
Date temp= new Date(longTime);
Date temp1= new Date(1154417769674);
}
}
Please study the code given above.
If the longTime variable is passed as it is programmatically to Date,
then there is no compilation error.
Date temp= new Date(longTime);
But, if i note it down and pass it like this
Date temp1= new Date(1154417769674);
The error is
DateDemo1.java:13: integer number too large: 1154417769674
Date temp1= new Date(1154417769674);
What may be the problem?
import java.text.*;
public class DateDemo1 {
public static void main(String args[]) throws ParseException {
Calendar cal = Calendar.getInstance();
cal.set(2006,7,1);
Date date = cal.getTime();
long longTime = date.getTime();
System.out.println("Long representation of date:"+longTime);
Date temp= new Date(longTime);
Date temp1= new Date(1154417769674);
}
}
Please study the code given above.
If the longTime variable is passed as it is programmatically to Date,
then there is no compilation error.
Date temp= new Date(longTime);
But, if i note it down and pass it like this
Date temp1= new Date(1154417769674);
The error is
DateDemo1.java:13: integer number too large: 1154417769674
Date temp1= new Date(1154417769674);
What may be the problem?