user1520494
user1520494

Reputation: 1184

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"

I would like to know how to apply the UTC time on the datepicker in order to avoid this error.

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

Upvotes: 1

Views: 302

Answers (1)

jayM
jayM

Reputation: 602

http://momentjs.com

You might want to use moment.js plugin for date handling on javascript, in the controller you simply do the follow:

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

Upvotes: 1

Related Questions