简体   繁体   English

dateTimePicker UTC引导程序

[英]dateTimePicker UTC Bootstrap

Each time that I choose a value from the datetimepicker and I send the info to the controller on the server side we are receiving a different time on the server side."caused by the UTC" 每次我从datetimepicker中选择一个值并将信息发送到服务器端的控制器时,我们都会在服务器端收到一个不同的时间。“由UTC引起”

I would like to know how to apply the UTC time on the datepicker in order to avoid this error. 我想知道如何在日期选择器上应用UTC时间以避免此错误。

  <input type="text" id="datePickId" class="form-control" ng-model="dateFrom" datepicker-popup="{{'dd-MM-yyyy'}}" is-open="openedTo" close-text="Close" />

http://momentjs.com http://momentjs.com

You might want to use moment.js plugin for date handling on javascript, in the controller you simply do the follow: 您可能要使用moment.js插件在javascript上进行日期处理,在控制器中,您只需执行以下操作:

var tmp = moment($scope.dateFrom).utc().format();

or 要么

var tmp = moment.utc($scope.dateFrom, 'MM-DD-YYYY').format();

It returns the UTC time formatted, hope it helps 它返回格式化的UTC时间,希望对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM