How to send long value in UTC format in moment?

119 Views Asked by At

Could you please tell me how to send long value in UTC format in moment and AngularJS. Actually I am getting LONG value from server. And then I am showing date in date picker.Now if user select any date from picker. I want to send in same format UTC. Could you please tell me how to send this in UTC

Here is my code
http://plnkr.co/edit/neixp9ZARRAQ33gKSV9u?p=preview

Here is the steps

  1. I am getting this from server

    var d = -2208988800000;
    
  2. show it on date picker

    var longdate =parseInt(utcMillSecondObj.format('x'));
    

it is working fine.
Now user change the date field using date picker. I want it value in UTC format? Is it possible?

$scope.changedate = function(value) {
  console.log(value)
}
<p class="input-group" ng-if="x.date=='date'">
  <input type="text" 
         view-value-changed='changedate(x.name)' 
         class="form-control" 
         uib-datepicker-popup="{{format}}" 
         ng-model="x.name" 
         is-open="x.opened" 
         datepicker-options="dateOptions" 
         ng-required="true" 
         close-text="Close" 
         alt-input-formats="formats" />
  <span class="input-group-btn">
    <button type="button" 
            class="btn btn-default" 
            ng-click="open1(x)">
      <i class="glyphicon glyphicon-calendar"></i>
    </button>
  </span>
</p>
0

There are 0 best solutions below