DD/MM/YYYY Date format in Moment.js

后端 未结 5 1143
北恋
北恋 2021-01-31 07:39

How can i change the current date to this format(DD/MM/YYYY) using moment.js?

I have tried below code.

$scope.SearchDate = moment(new Date(), \"DD/MM/YYY         


        
5条回答
  •  终归单人心
    2021-01-31 08:05

    This worked for me

    var dateToFormat = "2018-05-16 12:57:13"; //TIMESTAMP
    
    moment(dateToFormat).format("DD/MM/YYYY"); // you get "16/05/2018"
    

提交回复
热议问题