2

I wanted to achieve this format: "Saturday, August 30, 2014"

I have this code in my view:

{{masterlist.created_date}}

And the result looks like this:

/DATE(1452842730000)/

What should I do in my controller or in the view? Thanks.

1
  • Refer this answer for an explanation of the behavior Commented Feb 8, 2016 at 8:27

2 Answers 2

1

First of all you date should be in correct format

Use datefilter from angular {{masterlist.created_date | date:'fullDate'}}

Here is the doc

Sign up to request clarification or add additional context in comments.

4 Comments

OP's input won't get parsed by date filter alone. Input still needs to be able to be parsed by new Date()
This is the format data from MVC controller: /Date(1452842730000)/
Of course you can cut your timestamp from this format and then filter him, but it'll be dirty code. You need to send a correct timestamp from your MVC controller (only timestamp 1452842730000)
how will I do it? can you give me sample?
0

Angular provides many filters, among them one is for date. It provides various format to format your date. Read about them here: date filter: angularjs

But filters can prove performance bottleneck, so its better to avoid them nd format your date on server side.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.