请问如何获得系统日期,并把其转化为 String Date d = new Date();String str = d.toString(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.text.*;Date d=new Date();SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//其中yyyy-MM-dd是你要表示的格式String str=sdf.format(d); 一楼的就可以了吧d.toString() //Formats a date in the date escape format yyyy-mm-dd. import java.text.*;import java.util.*;class formatdate{ public formatdate() { Date d = new Date(); System.out.println(d.hashCode()); String sbf = new String(""); String sss = new String("yyyy-MM-dd 'at' kk-mm-ss "); SimpleDateFormat sdf = new SimpleDateFormat(sss); sbf = sdf.format(d); System.out.println(sbf); } public static void main(String args[]) { formatdate ddd = new formatdate(); }} java面试题 java代码实现日历表 Socket通信问题 如何实现csv文件的读写操作 如何让JInternalFrame中的控件随着窗口最大化自动跟着调整大小? 高手啊 CULT3D的JAVA小问题 怎样将.CLASS变成.EXE? 我想问个问题--来的人就有分 求救:如何用java或者javascript实现模拟键盘输入的方法? 不知哪位大哥有JDK中文帮助?如能不惜发给小弟,一定高分相送!E-Mail:[email protected] JAVA?
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//其中yyyy-MM-dd是你要表示的格式
String str=sdf.format(d);
d.toString()
//Formats a date in the date escape format yyyy-mm-dd.
import java.util.*;class formatdate
{
public formatdate()
{
Date d = new Date();
System.out.println(d.hashCode());
String sbf = new String("");
String sss = new String("yyyy-MM-dd 'at' kk-mm-ss ");
SimpleDateFormat sdf = new SimpleDateFormat(sss);
sbf = sdf.format(d);
System.out.println(sbf);
}
public static void main(String args[])
{
formatdate ddd = new formatdate();
}}