zoukankan      html  css  js  c++  java
  • Easyui的DateBox日期格式化

    DateBox 日期显示默认的格式为“dd/mm/yyyy”,如果想自定义成我们的格式需要实现两个函数,formatter和parser。
    formatter函数使得选择日期后将其格式化为我们需要的格式,parser函数在选择好日期后告诉控件如何去解析我们自定义的格式。
    定义如下:
    formatter:A function to format the date, the function take a 'date' parameter and return a string value.
    parser:A function to parse a date string, the function take a 'date' string and return a date value.
    如将日期格式化为yyyy-mm-dd的格式:
    $('#dd1').datebox({
        formatter: function(date){ return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();},
        parser: function(date){ return new Date(Date.parse(date.replace(/-/g,"/")));}
    });
  • 相关阅读:
    [状压DP][二分]JZOJ 3521 道路覆盖
    字符串操作
    练习: 判断一个数是否为小数
    Python 深浅拷贝
    编码
    python中的 == 和 is 的区别
    Python3 字典的增删改查
    Python3 列表的基本操作
    初识 Python
    方法的入门
  • 原文地址:https://www.cnblogs.com/wintalen/p/2077171.html
Copyright © 2011-2022 走看看