Ext控件收集到的时间为String "Tue Oct 30 10:48:48 UTC 0800 2012"如何转换为 Date 时间格式为 "yyyy-MM-dd HH:mm:ss"?

解决方案 »

  1.   

    一、把时间的长整数传到页面,例如json:"time":1351220666123二、GridPanel的列定义增加renderer,例如:
    {header:'日期', sortable:true, dataIndex:'time', width:130, align:'center', renderer:rendererDate},三、
    function rendererDate(value) {
        var dateObj= new Date(value);
        return dateObj.format('Y-m-d H:i:s');
    }
      

  2.   

    字符串收集的到的 Tue Oct 30 10:48:48 UTC 0800 2012这种格式的数据 
    要作为查询条件 传到数据库里
    我现在已经
    SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH);
    能把他转化为 Date类型
    但是 数据库的 格式是yyyy-MM-dd HH:mm:ss转化为数据库的格式进行时间对比怎么进行?》
      

  3.   

    数据库的 一般不是是yyyy-MM-dd这种类型的,除非真是用字符串类型存储时间
    数据库类型不同,sqlserver可直接比较,oracle用to_date
    不说了,没时间猜各种情况,第一次回答还以为问如何在ext上显示时间