Is there a way in angular JS to get Timestamp from a date obtained by a form?
To use in a controller you can do something like this:
myApp.controller('TimestampCtrl', ['$scope', function($scope) {
$scope.toTimestamp = function(date) {
var dateSplitted = date.split('-'); // date must be in DD-MM-YYYY format
var formattedDate = dateSplitted[1]+'/'+dateSplitted[0]+'/'+dateSplitted[2];
return new Date(formattedDate).getTime();
};
}]);
And can be used like this:
The timestamp of is {{ toTimestamp(date) }}