I am using the below code to get the current time in angularJS:
    $scope.getDatetime = function() {
        return (new Date()) + "abc.txt" ;
    };
What is the correct code to the current time in YYYY-MM-DD-Hours-Minutes-Seconds?
I am using the below code to get the current time in angularJS:
    $scope.getDatetime = function() {
        return (new Date()) + "abc.txt" ;
    };
What is the correct code to the current time in YYYY-MM-DD-Hours-Minutes-Seconds?
Maybe you need this.
  $scope.getDatetime = function() {
        var date = new Date();
        var day =  date.getDate();
        var month = ((date.getMonth() + 1) > 9) ? date.getMonth() + 1 :  "0" + (date.getMonth() + 1)
        var year = date.getFullYear();
        var hours = date.getHours();
        var minutes = date.getMinutes();
        var seconds =  date.getSeconds();
        return year+"/"+month+"/"+day+" "+hours+":"+minutes+":"+seconds;
    };
 
    
    var s = new Date().toISOString();
console.log(s);
s = s.slice(0,19);
s = s.replace('T','-');
s = s.replace(':','-');
s = s.replace(':','-');
console.log(s);