Reputation: 715
my model has a field date in mysql format "yyyy-mm-dd hh:ii:ss"
in my form id like to show this field in an input with a custom format : "dd/mm/yyyy"
<input [(ngModel)]="model.date" name="date" view-format="DD/MM/YYYY" model-format="YYYY-MM-DD HH:ii:ss" type="text" class="form-control datePickerUi" >
thanks for help ;)
Upvotes: 0
Views: 2578
Reputation: 2676
There is a package called moment that allows you to do all kinds of neat things with dates. http://momentjs.com/docs/
Upvotes: 1
Reputation: 317
I have not tested this but it looks like theirs a directive on github to do this. Seen here: https://github.com/eight04/angular-datetime
you would need this code:
<input type="text" datetime="yyyy/MM/dd" ng-model="myDate">
hope it helps!
Upvotes: 0