for this type of Err ==> Type mismatch: cannot convert from long to String.
public class LongToString {
public static void main(String q[]){
long lDateTime = new Date().getTime();
System.out.println("Date() - Time in milliseconds: " + lDateTime);
Calendar lCDateTime = Calendar.getInstance();
System.out.println("Calender - Time in milliseconds :" + lCDateTime.getTimeInMillis());
String s = String.valueOf(lCDateTime.getTimeInMillis());
System.out.println("Long to Sting :" + s);
}
}
public class LongToString {
public static void main(String q[]){
long lDateTime = new Date().getTime();
System.out.println("Date() - Time in milliseconds: " + lDateTime);
Calendar lCDateTime = Calendar.getInstance();
System.out.println("Calender - Time in milliseconds :" + lCDateTime.getTimeInMillis());
String s = String.valueOf(lCDateTime.getTimeInMillis());
System.out.println("Long to Sting :" + s);
}
}
No comments:
Post a Comment