日期的时区在日期管道中不起作用 - angular 5
Timezone for date not working in Date pipe - angular 5
我正在从我的数据库中的日期列中获取数据。我尝试使用日期管道将其格式化为时区。下面是代码
<ng-container matColumnDef="invoiceDate">
<mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
<mat-cell *matCellDef="let invoice"> {{invoice.invoiceDate | date: 'mediumDate' : 'EDT'}} </mat-cell>
</ng-container>
它在我的本地环境中运行良好,而应用程序部署在 AWS 中并且数据库是 AWS RDS (postgres),并且在此环境中时区不起作用。 AWS 机器的默认时区是 GMT。任何建议都会很好 help.For 例如数据库中的数据是 2018-08-18 12:00:00 但在前端它显示 2018-08-17 21:00:00
我用准确的时间增量编辑了时区以解决此问题。
<ng-container matColumnDef="invoiceDate">
<mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
<mat-cell *matCellDef="let invoice"> {{invoice.invoiceDate | date: 'mediumDate' : '+0100'}} </mat-cell>
</ng-container>
我正在从我的数据库中的日期列中获取数据。我尝试使用日期管道将其格式化为时区。下面是代码
<ng-container matColumnDef="invoiceDate">
<mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
<mat-cell *matCellDef="let invoice"> {{invoice.invoiceDate | date: 'mediumDate' : 'EDT'}} </mat-cell>
</ng-container>
它在我的本地环境中运行良好,而应用程序部署在 AWS 中并且数据库是 AWS RDS (postgres),并且在此环境中时区不起作用。 AWS 机器的默认时区是 GMT。任何建议都会很好 help.For 例如数据库中的数据是 2018-08-18 12:00:00 但在前端它显示 2018-08-17 21:00:00
我用准确的时间增量编辑了时区以解决此问题。
<ng-container matColumnDef="invoiceDate">
<mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
<mat-cell *matCellDef="let invoice"> {{invoice.invoiceDate | date: 'mediumDate' : '+0100'}} </mat-cell>
</ng-container>