整形转换成字符串
String str=""+i;//i是整形
日期可以直接用作字符串

解决方案 »

  1.   

    String times=new java.util.Date();提示错误:
    The type of the left-hand side in this assignment, "java/lang/String", is not compatible with the type of the right-hand side expression, "java/util/Date".
      

  2.   

    public static String GetDateStr(java.sql.Timestamp rDate, String rDateFormat) {
            SimpleDateFormat lFormat;        lFormat =  new SimpleDateFormat(rDateFormat);
            gRtnStr = lFormat.format(rDate);        return gRtnStr;
        }    public static String GetDateStr(java.util.Date rDate, String rDateFormat) {
            SimpleDateFormat lFormat;        lFormat =  new SimpleDateFormat(rDateFormat);
            gRtnStr = lFormat.format(rDate);        return gRtnStr;
        }
      

  3.   

    java.util.Date times=new java.util.Date();
    String tm=times.toString();
    String tm1=times.toLocaleString();
    这样就行了
      

  4.   

    转换后用simpleDateFormate("YYYY-MM-DD").format(Date)看看可以不!
    ================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★  浏览帖子速度极快![建议系统使用ie5.5以上]。 ★  多种帖子实现界面。 
    ★  保存帖子到本地[html格式]★  监视您关注帖子的回复更新。
    ★  可以直接发贴、回复帖子★  采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录! 
    ★  支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名  ●  
         可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
    Http://www.ChinaOK.net/csdn/csdn.rar
    Http://www.ChinaOK.net/csdn/csdn.exe    [自解压]
      

  5.   

    转换后用simpleDateFormate("YYYY-MM-DD").format(Date)看看可以不!
    不还是年月日吗
    ================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★  浏览帖子速度极快![建议系统使用ie5.5以上]。 ★  多种帖子实现界面。 
    ★  保存帖子到本地[html格式]★  监视您关注帖子的回复更新。
    ★  可以直接发贴、回复帖子★  采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录! 
    ★  支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名  ●  
         可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
    Http://www.ChinaOK.net/csdn/csdn.rar
    Http://www.ChinaOK.net/csdn/csdn.exe    [自解压]
      

  6.   

    simpleDateFormate("YYYY-MM-DD").format(Date)这个方法不行啊。
      

  7.   

    获取今天的日期字符串:
    String today=java.text.DateFormat.getDateInstance().format(new java.util.Date());日期型转化成字符串:
    String java.text.DateFormat.getDateInstance().format(date);