在json数据响应中来自$ http.get的angularjs中的格式化日期 [英] Format date in angularjs coming from $http.get in json data response
问题描述
Iam通过$ http.get调用方法和日期提交的响应如下所示。需要转换为MM / dd / yyyy格式的日期
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
推荐答案
http.get和日期提交的回复如下。需要转换为MM / dd / yyyy格式的日期
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
你可能过于复杂事情。
javascript中的格式日期 - Google搜索 [ ^ ]
你有几个选择,但你可以做一些像
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.
这篇关于在json数据响应中来自$ http.get的angularjs中的格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!