zoukankan      html  css  js  c++  java
  • C# Js 时间格式化问题

    C# 后台:

    .ToString("dd-MMM-yyyy", System.Globalization. DateTimeFormatInfo.InvariantInfo)   eg : 29-Aug-2013
    

    Js 前台:

    monName = new Array( "Jan", "Feb" , "Mar", "Apr", "May" , "Jun", "Jul", "Aug" , "Sept", "Oct", "Nov" , "Dec")
    
    Date.prototype.format = function (format) {
        if (!format) {
            format = "yyyy-MM-dd hh:mm:ss";
        }
    
        if (/(y+)/.test(format)) {
            format = format.replace(RegExp.$1, ( this.getFullYear() + "" ).substr(4 - RegExp.$1.length));
        }
        if (/(M+)/.test(format)) {
            format = format.replace(RegExp.$1, (monName[ this.getMonth()] + "" ).substr(3 - RegExp.$1.length));
        }
        if (/(d+)/.test(format)) {
            format = format.replace(RegExp.$1, ( "00" + this .getDate() + "").substr(( "" + this .getDate()).length));
        }
        return format;
    };
    
    
    function formatJsonDate(str) {
    
        if (str != null &&str!='') {
            return (new Date(parseInt(str.substring(str.indexOf( '(') + 1, str.indexOf(')' ))))).format("dd-MMM-yyyy");
        }
        else {
            return '' ;
        }
    

      

         讨论群请加QQ群181537678

    世上本无垃圾,所谓垃圾是你放错了地方

  • 相关阅读:
    IP寻址方式三
    IP通信基础4
    IP通信基础3
    IP通信基础2
    IP通信基础 1
    IP通信基础
    IP通信原理第二周
    设备选型
    常用virsh命令记录
    [转]enable spice html5 console access in openstack kilo(centos)
  • 原文地址:https://www.cnblogs.com/yhyjy/p/3394021.html
Copyright © 2011-2022 走看看