In my database i am storing date in this format 2015-12-14 00:00:00(yy/mm/dd h:m:s).How can i convert this date into this format 14 dec 2015 in angularjs ?Here is the format of my angular data:
{{data.time_stamp}}
In my database i am storing date in this format 2015-12-14 00:00:00(yy/mm/dd h:m:s).How can i convert this date into this format 14 dec 2015 in angularjs ?Here is the format of my angular data:
{{data.time_stamp}}
First, store mysql date in a jscript date object:
var aux = "2015-12-14 00:00:00".split(/[- :]/);
var vdate = new Date(aux[0], aux[1]-1, aux[2], aux[3], aux[4], aux[5]);
Then, Angular code is quite simple and documented, for example:
{{vdate | date:'dd MMM yyyy'}}
Check official information here: https://docs.angularjs.org/api/ng/filter/date
Regards
Use Angular's built in filter for dates. https://docs.angularjs.org/api/ng/filter/date
{{ date_expression | date : format : shortDate}}