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/YYYY");
But it's return 0037-11-24T18:30:00.000Z
. Did't help to format current date.
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/YYYY");
But it's return 0037-11-24T18:30:00.000Z
. Did't help to format current date.
You need to call format() function to get the formatted value
The syntax you have used is used to parse a given string to date object by using the specified formate
This actually worked for me:
This worked for me
You can use this
However, this returns a date string in the specified format for today, not a moment date object. Doing the following will make it a moment date object in the format you want.