I want to format date as mm/dd/yyyy
. I tried the following and none of it works for me.
Can anyone help me with this?
reference: ui-date
<input ui-date ui-date-format="mm/dd/yyyy" ng-model="valueofdate" />
<input type="date" ng-model="valueofdate" />
I use filter
then
I am using this and it is working fine.
ng-bind="reviewData.dateValue.replace('/Date(','').replace(')/','') | date:'MM/dd/yyyy'"
Use this should work well. :) The reviewData and dateValue fields can be changes as per your parameter rest can be left same
This isn't really exactly what you are asking for - but you could try creating a date input field in html something like:
Then to print this on the page you would use:
Finally, in my controller I declared a method that creates a date from the input value (which in chrome is apparently parsed 1 day off):
So there you have it. To see the whole thing working see the following plunker: http://plnkr.co/edit/8MVoXNaIDW59kQnfpaWW?p=preview .Best of luck!
Just pass UTC date format from your server side code to client side
and use below syntax -