`
liuwang126
  • 浏览: 180660 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

date().toString 变date

 
阅读更多

 

 

 public static void main(String[] args) {
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String i=new Date().toString();
        System.out.println(i);
        Date d=new Date(i);
        System.out.println(format.format(d));


        String s = new Date().toString();
        System.out.println(s);
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss zzz yyyy", Locale.US);
            Date da = sdf.parse(s);
            System.out.println(format.format(da));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
分享到:
评论

相关推荐

    NextDate函数

    软件测试NextDate函数测试用例 System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"); //2008年04月24 15时56分48秒 System.DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒"); //星期二, 四月 24 ...

    多种获得当前时间方法

    //获取日期+时间 DateTime.Now.ToString(); // 2008-9-4 20:02:10 DateTime.Now.ToLocalTime().ToString(); // 2008-9-4 20:12:12 ...DateTime.Now.Date.ToString(); // 2008-9-4 0:00:00 还有更多方法,请下载学习

    js对日期操作

    Date.prototype.toString 日期转字符串 Date.prototype.toArray 日期分割为数组 Date.prototype.DatePart 取日期的部分信息 Date.prototype.MaxDayOfDate 取日期所在月的最大天数 Date.prototype.WeekNumOfYear 判断...

    js日期时间格式验证,时间比较

    Date.prototype.toString 日期转字符串 Date.prototype.toArray 日期分割为数组 Date.prototype.DatePart 取日期的部分信息 Date.prototype.MaxDayOfDate 取日期所在月的最大天数 Date.prototype.WeekNumOfYear 判断...

    C#(ASP.NET)DateTime日期类型格式化显示

    Convert.ToDateTime("2005-8-23").ToString ("yyMMdd",System.Globalization.DateTimeFormatInfo.InvariantInfo); //支持繁体数据库 5.直接用ToString方法转换日期显示格式: DateTime.Now.ToString(...

    Unity中 日历面板(NGUI)

    string year = date.Year.ToString(); string month = date.Month.ToString(); string day = date.Day.ToString();

    java常用包。Date类,tostring方法视频

    java内常用包,date类,toString的使用方法

    c#中的常用ToString()方法总结

    对于int,double等的tostring: C     货币     2.5.ToString(“C”)     ¥2.50     D     十进制数     25.ToString(“D5”)     00025     E     科学型     25000....

    LINQ字符串向datetime 转换时失败的处理方法

    代码如下:from j in system.jhzdwhere j.dwbm.ToString().Trim() == branchcode.ToString().Trim()&& Convert.ToDateTime(j.yearmonth.ToString().Trim()).CompareTo(Convert.ToDateTime(timeFrom)) >= 0&& Convert...

    C#中时间的几种格式转换方法

    有时候我们要对C#时间进行转换,达到不同的显示效果 默认格式为:2005-6-614:33:34 如果要换成成200506,06-2005,2005-6-6或更多的该怎么办呢... Response.Write(date.ToString(format,DateTimeFormatInfo.InvariantInfo))

    C# 编程连接oracle数据库方法

    selcmd.CommandText = "select * from emp where HIREDATE < to_date('1987-11-26','yyyy-mm-dd') "; OleDbDataAdapter da = new OleDbDataAdapter(); da.SelectCommand = selcmd; DataSet ds = new ...

    JavaScript权威指南

    The Date Object Section 3.10. Regular Expressions Section 3.11. Error Objects Section 3.12. Primitive Data Type Wrapper Objects Chapter 4. Variables Section 4.1. Variable Typing Section...

    js内置对象处理_打印学生成绩单的简单实现

    var year=date.toString().slice(11,15); [removed](year.toString()+"年"); var month=date.getMonth(); month=month+1; if(month<10){ [removed]("0"+month+"月"); }else{ [removed](month+"月"); } var day=...

    ajax web service

    if (TextGCPWF.Text != "") { string sql = "select * from CostInfo where c_sid=" + uid + "";... string Date = dss.Tables[0].Rows[0]["date"].ToString(); DATA = Convert.ToInt32(Date); } }

    浅谈c#.net中巧用ToString()将日期转成想要的格式

    C#时间/日期格式大全,C#时间/日期函数大全 有时候我们要对时间进行转换,达到不同的显示效果 默认格式为:2005-6-6 14:33:34 如果要换成成200506,06-2005,2005-6-6或更多的该怎么办呢?...Response.Write(date.ToStrin

    JavaScript中用toString()方法返回时间为字符串

    Date.toString() 下面是参数的详细信息: NA 返回值: 返回表示指定日期对象的字符串 例子: <html> <head> <title>JavaScript toString Method</title> </head> <body> ...

    C#日期格式强制转换方法(推荐)

    C#编写winform程序时,用到的,格式强转,存储到数据库,数据库连接那块就不写了 ...str1 = date.ToString(yyyy/MM/dd); string str2 = deDueDate.EditValue.ToString(); DateTime date2; DateTime.TryParse(str2, out

    flex开发对时间控制

    '/' + (date.getMonth()+1).toString() + '/' + date.getDate(); } ]]> paddingTop="10" paddingLeft="10" paddingRight="10"> text="Select a date in the DateField control. Select it again to ...

    jsp 火车订票系统

    List lstTrainNoSeatExist = this.sellTicketService.queryNoSeat(intervalBit.longValue(), Integer.parseInt(obj[0].toString()), date); if(lstTrainNoSeatExist.size() > 40){ jsObj.put("无座",...

    JSON序列化与反序列化JAVA工具

    java.util.Date date = new java.util.Date(); //生成1万个序列化後的文本 for (ji_i = 0; ji_i ; ji_i++) { bjson = org.hzs.json.JSONObject.d副本(); bjson.put("a1", d1.nextDouble()); bjson.put("a2", ...

Global site tag (gtag.js) - Google Analytics