我想使用android studio将当前日期插入到mysql数据库中。我正在使用排球库进行插入。仅需要提示,而不是详细说明。谁能帮我? 提前谢谢!
答案 0 :(得分:0)
> You should try this one for getting current date:
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
String todate= dateFormat.format(currentdate());
String finalto = todate.toString(); //here you get current date
private Date currentdate() {
final Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 0);
return cal.getTime();
}