[英]Show as it is date from moment irrespective of time zone
I did console logging for moment object and its showing following results:我对 object 进行了控制台日志记录,并显示以下结果:
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.我想在 UI 上显示
Thu Mar 18 2021 18:00:00
,无论用户位置和他/她当前的时区如何。
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:在 html 文件中为:
<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
但它显示
Response due date: 2021-03-18 12:30:00 PM
{{ 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}}
如果这不起作用,您可以使用
{{response_date_string|json}}
调试您的response_date_string变量
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.