zoukankan      html  css  js  c++  java
  • time

    public ActionResult GetAllList()         {

                var list = db.Movies.ToList();

                return Json(list, JsonRequestBehavior.AllowGet);             //return Content(a);

            }

    @section Scripts{
        <script type="text/javascript">
            function formatNumToDate(value) {
              var now = eval(value.replace(//Date((d+))//gi, "new Date($1)"));///.../gi是用来标记正则开始和结束;是转义符;()标注了正则匹配分组1,$1
              var year = now.getYear() + 1900;
              var month = now.getMonth() + 1;
              var date = now.getDate();
              var hour = now.getHours();
               var minute = now.getMinutes();
               var second = now.getSeconds();
               return year + "-" + compareNine(month) + "-" + compareNine(date) + " " + compareNine(hour) + ":" + compareNine(minute) + ":" + compareNine(second);
           }
    
            $(document).ready(function () {
                function ChangeDateFormat(time) {
                    if (time != null) {
                        var date = new Date(parseInt(time.replace("/Date(", "").replace(")/", ""), 10));
                        var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                        var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                        return date.getFullYear() + "-" + month + "-" + currentDate;
                    }
                    return "";
                }
                $("#TestList").click(function () {
    
                    $.getJSON("/Movies/GetAllList", {}, function (result) {
                        
                        alert(result);
                        $.each(result, function (i, field) {
                            //var datetime = field.ReleaseDate.formatNumToDate();
                            
                            alert(i + " " + ChangeDateFormat(field.ReleaseDate));
    
                        });
    
    
    
    
    
    
    
                    });
                });
    
    
            });
         </script>
        }
  • 相关阅读:
    课程的添加与发布
    openlayers 框选得到在选框内的要素,并标注出这些要素的名称
    手写js前端分页功能实现
    eclipse安装html编辑器插件
    Redis持久化技术
    java获取指定时间
    java生成Cron表达式
    CentOS7 ifcfg-ens33(没有eth0网卡) 网卡配置 静态IP地址
    java代码关闭tomcat程序
    Tomcat控制台乱码问题
  • 原文地址:https://www.cnblogs.com/MarchThree/p/3717987.html
Copyright © 2011-2022 走看看