【问题标题】:angularjs convert date format to ISTangularjs将日期格式转换为IST
【发布时间】:2015-12-17 06:12:18
【问题描述】:

我想将日期从 2015-12-02T18:30:00.000+0000 转换为 Wed Dec 02 2015 00:00:00 GMT+0530(印度标准时间) strong> 使用 angularjs。

【问题讨论】:

    标签: angularjs


    【解决方案1】:

    您可以使用 Angular 的 date 过滤器。格式明确给出here

    {{'2015-12-02T18:30:00.000+0000' | date:"EEE MMM dd yyyy HH:hh:ss 'GMT'Z '(India Standard Time)'"}}
    

    上面的代码 sn-p 会在输出中给你Thu Dec 03 2015 00:12:00 GMT+0530 (India Standard Time)。那是您从+0000 计算到+0530 的时间

    Here 是一个可行的解决方案

    【讨论】:

      【解决方案2】:

      Working fiddle

      HTML:

      <div ng:app ng:controller="Scoper">
          Input: {{v}}  <br />
          Angular: {{v | date:'EEE MMM dd yyyy HH:mm:ss'}} GMT{{v | date:'+0530' }} (India Standard Time) <br />
      
      </div>
      

      JS

      function Scoper($scope) {
          var s = "2015-12-02T18:30:00.000+0000";
          $scope.v = s;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多