美文网首页
daterangepicker年月日时分

daterangepicker年月日时分

作者: Lyon0616 | 来源:发表于2017-02-28 15:37 被阅读0次
HTML
<div class="form-group">
    <label for="startTime" class="col-sm-3 control-label must-info">开始时间:</label>
    <div class="col-sm-7">
    <input class="form-control datetimepicker" type='text'
id="startTime" name="startTime" placeholder="请选择时间" />
        <div>
    <label for="startTime" class="error"></label>
    </div>
    </div>
</div>
JS
/**
 * 初始化时间//平台方法
 */
function initdate_second(id){
    if($(id).length != 0){
        if(typeof(id)!= 'string'){
            $.each(id,function(index,value){
                var $curentwrap = $(value).parent();
                var $curent_lable = $curentwrap.find('label');
                var $curent_input = $curentwrap.find('input');
                $(value).remove();
                $curent_lable.after($curent_input);
                $(value).datetimepicker({
                    format: 'YYYY-MM-d HH:mm:ss',
                    locale: 'zh-cn',
                    ignoreReadonly: true
                });
            });
        }else{
            var $curentwrap = $(id).parent();
            var $curent_lable = $curentwrap.find('label');
            var $curent_input = $curentwrap.find('input');
            $(id).remove();
            $curent_lable.after($curent_input);
            $(id).datetimepicker({
                //format: 'lll',
                format: 'YYYY-MM-DD HH:mm:ss',
                locale: 'zh-cn',
                ignoreReadonly: true
            });
        }
    }

}

function initDate(){
  //哪个需要就给哪个传参数
    initdate_second("#startTime");
    initdate_second("#endTime");
    initdate_second("#exStartTime");
}
initDate();
//格式化到时分秒
function initDateHMS(){
      $(id).datetimepicker({
              format: 'YYYY-MM-d HH:mm:ss',
              locale: 'zh-cn',
              ignoreReadonly: true
      });
}
//格式化到天
function initDateDay(){
      $(id).datetimepicker({
              format: 'L',
              locale: 'zh-cn',
              ignoreReadonly: true
      });
}

相关文章

  • daterangepicker年月日时分

  • 【Swift/Objective-C】强劲的日期选择控件

    日期选择器,支持年、年月、年月日、年月日时分、年月日时分秒、时分、时分秒、月日周 时分等,内置了3种样式。 由于使...

  • 系统时间相关-date

    1.查看系统时间 年月日 完整显示年月日 完整显示年月日 时分秒 时分秒 星期 显示过去或未来的时间信息: 同步系...

  • Day19-课堂笔记-time

    主要包含处理年月日时分秒对应的时间(着重时分秒)import time专门处理年月日import datetime...

  • datetime:时间戳转换

    将时间戳转换为年月日时分秒格式: 将年月日时分秒格式转换为时间戳:

  • day19

    一、time模块 主要包含处理年月日时分秒对应的事件(着重时分秒)import time 专门处理年月日impo...

  • day19-time模块

    一、time模块 主要包含处理年月日时分秒对应的事件(着重时分秒)import time 专门处理年月日impo...

  • day19-time模块

    1. 时间模块 主要包含处理年月日时分秒对应的时间(着重时分秒)import time 专门处理年月日import...

  • day19-time模块

    01-时间模块 主要包含处理年月日时分秒对应的时间(着重时分秒)import time 专门处理年月日import...

  • js常用对时间的处理,字符串转时分秒,毫秒值与年月日互换。

    1.毫秒数转年月日时分秒 2.年月日时分秒转毫秒数 3.输入数字转化成 时分秒格式– eg:时间经过了130S处理...

网友评论

      本文标题:daterangepicker年月日时分

      本文链接:https://www.haomeiwen.com/subject/glixgttx.html