js对LocalDateTime时间的格式化成yyyy-MM-dd HH:mm:ss

formatter: function(value,row,index){
                var arr = value;
                if(arr==null || arr==""){
                    return "-";
                }else{
                    for(var i = 0; i < arr.length; i++){
                        if(arr[i].length == 1){
                            arr[i] = "0" + arr[i];
                        }
                    }
                    if(arr.length == 5){
                        var getFormatTime = arr[0] + "-" + arr[1] + "-" + arr[2] + "\t" + arr[3] + ":" + arr[4] + ":" + "00";
                    }else{
                        var getFormatTime = arr[0] + "-" + arr[1] + "-" + arr[2] + "\t" + arr[3] + ":" + arr[4] + ":" + arr[5];
                    }
                    
                    return getFormatTime;
                }
                
            }

 

posted @ 2019-03-20 11:18  云晴  阅读(3349)  评论(0编辑  收藏  举报