The following code gets the date:
private static String get_date() {
return (new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")).format(Calendar.getInstance().getTime());
}
using import java.text.SimpleDateFormat;
How can I do the above only by using a import java.util.*;
Is it okay to do it like this? Why I get warnings?
Date date= new java.util.Date();
String s = (date.getYear()+1900)+"/"+date.getMonth()+"/"+date.getDay()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();