methuselah methuselah - 1 year ago 81
AngularJS Question

Convert date in UK format and Django format to real date

I am trying to convert
, which is in the following format
to the format
'EEEE, MMMM d, y' (Wednesday, June, 1, 2016)
. I've tried the following AngularJS filter date but it doesn't seem to be working. Any suggestions?

<p style="small">{{ | date:'fullDate' }}<br>{{ booking.time }}</p>

I also have another date in the format:
elsewhere, is there another approach I can take for this as well?

Answer Source

You need to convert the date string into a Date() object before submitting into the date filter.

// in controller = new Date(;

// template can remain same
<p>{{ | date:'fullDate'}}</p>

// test code 
console.log($filter('date')(new Date('2016-05-31T19:18:24Z'), 'fullDate'));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download