AngularJs get Timestamp from a human readable date

后端 未结 3 1933
刺人心
刺人心 2021-01-13 20:53

Is there a way in angular JS to get Timestamp from a date obtained by a form?




        
3条回答
  •  梦毁少年i
    2021-01-13 21:05

    Since you are using input type as date, the string in model should be compatible with Date object in javascript. So you can do

    var timestamp = new Date($scope.startDate).getTime()

提交回复
热议问题