Reputation: 10755
I did console logging for moment object and its showing following results :
Moment {_isAMomentObject: true, _i: "/Date(1616070600000+0530)/", _isUTC: true, _pf: {…}, _locale: Locale, …}
_d: Thu Mar 18 2021 18:00:00 GMT+0530 (India Standard Time) {}
I want to show on UI is Thu Mar 18 2021 18:00:00
irrespective of user location and his/her current time zone.
I tried something like this
console.log(moment.utc(this.response_d));
this.res_d = moment.utc(this.response_d).utcOffset('+5:30').format('YYYY-MM-DD h:mm:ss A');
and in html file as :
<div class="ItemBox QuantityGrid MiniGrid responseDate">
Response due date :
{{ res_d }}
</div>
but it shows Response due date : 2021-03-18 12:30:00 PM
Upvotes: 0
Views: 157
Reputation: 780
I don't have anough details about your response_data_string how it is got in your TypeScript controller..
But I recommand you to use [angular date pipe](https://angular.io/api/common/DatePipe) instead of using moment instance inside your html template.
But if you want , did you tried to force formatting your moment instance like this :
{{ moment(response_date_string,'YYYY-MM-DD HH:mm:ss').toDate()|date }}
if this is not working, you can debug your response_date_string variable by using {{response_date_string|json}}
Upvotes: 1