Click here to Skip to main content
13,900,697 members
Rate this:
 
Please Sign up or sign in to vote.
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
   
Comments
kongalshiva549 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190306.1 | Last Updated 14 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100