[英]I need to convert UTC date and time based on the local timezone using moment.js, how to convert date from UTC to timezone in html
The code below is displaying date in UTC format not in local timezone.下面的代码以 UTC 格式显示日期,而不是本地时区。
<mat-cell *matCellDef="let element; let i=index" class="table-width__26">
{{moment(element.CREATED_DATE).format('MM/DD/YYYY')}} {{'at'}}
{{ getTime(element.CREATED_DATE,timezone)}}
{{ moment.tz([2012,0],timezone).format('z').substr(0, 1) + moment.tz([2012,0],timezone).format('z').substr(2)}}
</mat-cell>
If you can find your timezone name you can use at below:如果你能找到你的时区名称,你可以在下面使用:
moment(1369266934311).tz(' Melikgazi/Kayseri').format('YYYY-MM-DD HH:mm')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.