0

How can I change a date string to another date format in angularjs?
Lets say I get from DB a string in this format: "31/01/2015 2:21 PM".
I need to change it to "31-Jan-2015 14:21". Thanks.

2

1 Answer 1

0

I am assuming perhaps incorrectly that you want to display your date.. You can use the html time element:

<time [attr.datetime]="Post.PublishDate">
    {{Post.PublishDate | date: 'longDate' }}
</time>

Edit: per question substitute 'longDate' with your format string i.e. 'dd-MMM-yyyy'.

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

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.