Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Iam calling method through $http.get and date filed response is coming as below. Need to convert date in MM/dd/yyyy format

MileStoneDate: "/Date(1536258600000)/"
ProjectId: 11
Status: "High Risk"
UpdateDate: "/Date(1538505000000)/"


What I have tried:

Tried to use filter option but did not work
Posted
Updated 14-Mar-19 6:49am

1 solution

You are likely over complicating things.

format date in javascript - Google Search[^]

You have a few options but you can just do something like

data.MileStoneDate.getMonth() + "/" + data.MileStoneDate.getDate() + "/" + data.MileStoneDate.getFullYear()


There are other libraries that make formatting dates more "enjoyable" but this would be one of a ton of ways to accomplish what you need. If that doesn't work, a simple google search (like the one provided) will surely provide you what you need.
 
Share this answer
 
Comments
Chinnu2020 14-Mar-19 13:12pm    
i tried as you mentioned above and getting "data.CurrentAsOf.getMonth is not a function"
$scope.PopupDetails.CurrentAsOf = data.CurrentAsOf.getMonth() + "/" + data.CurrentAsOf.getDate() + "/" + data.CurrentAsOf.getFullYear();
David_Wimbley 14-Mar-19 15:31pm    
Look at the google search and pick any of those top few links, your answer is there. If you show you've made an effort i'll be happy to help some more but what i've provided basically got you 90% of the way there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900