Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在文本字段中显示日期,这就是我所做的
java.util.Date date=new java.util.Date(); this.DateObject.setText(date);
但它显示错误...
试试下面的代码。
Date now = new Date(); //Set date format as you want SimpleDateFormat sf = new SimpleDateFormat("dd-MM-yy"); this.DateObject.setText(sf.format(now));
您可能需要对其进行toString操作
toString
this.DateObject.setText(date.toString());