zoukankan      html  css  js  c++  java
  • js

    $('.form_datetime').datetimepicker({
    //language: 'fr',
    weekStart: 1,
    todayBtn: 1,
    autoclose: 1,
    todayHighlight: 1,
    startView: 2,
    forceParse: 0,
    showMeridian: 1,
    format: 'yyyy-mm-dd hh:ii:ss'
    });
    $('.form_datetime').datetimepicker().on('changeData', function () {
    console.log($('#dtp_input1').val())
    $('.form_date').datetimepicker('setStartDate', '2020-11-12 12:13:50')
    })
    $('.form_date').datetimepicker({
    language: 'fr',
    format: 'yyyy-mm-dd hh:ii:ss',
    startDate: '2019-06-20 20:45:14',
    // weekStart: 1,
    todayBtn: 1,
    autoclose: 1,
    todayHighlight: 1,
    startView: 2,
    minView: 2,
    forceParse: 0
    });
    var zoneObj = {
    'IN': 7,
    'ID': 5.5,
    'TH': 7,
    'VN': 7,
    'MY': 8,
    'PH': 8,
    'TW': 8
    }
    Date.prototype.format = function (fmt) {
    var o = {
    "M+": this.getMonth() + 1, //月份
    "d+": this.getDate(), //日
    "h+": this.getHours(), //小时
    "m+": this.getMinutes(), //分
    "s+": this.getSeconds(), //秒
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度
    "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) {
    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    }
    for (var k in o) {
    if (new RegExp("(" + k + ")").test(fmt)) {
    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[
    k])
    .length)));
    }
    }
    return fmt;
    }

    function getServerDate() {
    return new Date($.ajax({
    async: false
    }).getResponseHeader("Date"));
    }

    function getLocalTime(i) {
    if (typeof i !== "number") {
    return new Date();
    }
    var d = getServerDate();
    var len = d.getTime();
    var offset = d.getTimezoneOffset() * 60000;
    var utcTime = len + offset;
    return new Date(utcTime + 3600000 * i);
    }

    function eachAreaTime(Tzone) {
    var timezone = Tzone; // 时区 : 东区时区1~12 西区时区-1~-12
    var date, localTime;
    date = getLocalTime(timezone).toString().split("GMT+")[0].toString();
    localTime = new Date(date).format("yyyy-MM-dd hh:mm:ss");
    return localTime;
    }
    console.log(eachAreaTime(7),eachAreaTime(8),eachAreaTime(5.5))
    $('.countcheck').change(function () {
    var ct = $(this).attr("bindname");
    if ($(this).prop("checked") == true) {
    var times =eachAreaTime(zoneObj[ct]);
    $('.config' + ct).show();
    if ($(this).val() == "all") {
    $('.countcheck').prop("checked", true);
    $('.config').hide();
    $('.configall').show();
    }
    $('.config'+ct).find('.form_datetime').datetimepicker('setStartDate',times)
    // $('.form_date').datetimepicker('setStartDate', '2020-11-12 12:13:50')
     
    } else {
    var ct = $(this).attr("bindname")
    if ($(this).val() == "all") {
    $('.countcheck').prop("checked", "")
    $('.config').hide();
    $('.configall').hide();
    } else {
    $('input[value="all"]').prop("checked", "")
    $('.configall').hide();
    $('.config' + ct).hide();
    }
    }
    // debugger;
    })
  • 相关阅读:
    LeetCode 15 3Sum
    R语言函数化学习笔记6
    R语言函数化学习笔记4
    R语言函数化学习笔记3
    R语言函数化编程笔记2
    R语言读写数据
    R语言函数化编程笔记1
    服务&软件&基础设施的区别
    网易云热评1很扎心
    滞后项
  • 原文地址:https://www.cnblogs.com/yunshangwuyou/p/10970950.html
Copyright © 2011-2022 走看看