zoukankan      html  css  js  c++  java
  • REST查询 datetime类型

    1,查询时间类型的时候 时间取值要用UTC时间,转成待定格式的字符串

    例如:$filter=new_date ge datetime'2010-09-10T12:00:00' and new_date le datetime'2010-09-12T12:00:00' and new_type/Value ne 100000000

    时间转换函数如下 :
    function GetUTCDate(date) {
    var year = date.getUTCFullYear();
    var month = date.getUTCMonth() + 1;
    if (month < 10) {
    month = "0" + month.toString();
    }
    var day = date.getUTCDate();
    if (day < 10) {
    day = "0" + day.toString();
    }
    var hour = date.getUTCHours();
    if (hour < 10) {
    hour = "0" + hour.toString();
    }
    var min = date.getUTCMinutes();
    if (min < 10) {
    min = "0" + min.toString();
    }
    var second = date.getUTCSeconds();
    if (second < 10) {
    second = "0" + second.toString();
    }



    return year.toString() + "-" + month.toString() + "-" + day.toString() + "T" + hour.toString() + ":" + min.toString() + ":" + second.toString()+"Z";
    }

  • 相关阅读:
    DOM
    JS方法
    边界与边框,列表与方块
    for 练习
    背景与前景温习
    AD域账号验证
    邮件发送案例
    获取每个月最后一天的小技巧
    SQL 执行顺序
    常用下载地址
  • 原文地址:https://www.cnblogs.com/z1984/p/2948063.html
Copyright © 2011-2022 走看看