angular-date-format

How to convert Date in angular to another time zone

本小妞迷上赌 提交于 2020-06-26 04:26:06
问题 I am using Date() to get the current time in local time zone. And I have formatted that as follows: this.today = new Date(); from = new DatePipe('en-Us').transform(this.today, 'dd:MM:yyyy hh-mm-ss'); Now I want to convert the from date time to Europe/London time zone. How Can I do this without moment . Please help me 回答1: I solved my issue by adding an another parameter for timezone according to https://angular.io/api/common/DatePipe Here is the update code: to = new DatePipe('en-Us')

angular 2 date pipe weeknumber

匆匆过客 提交于 2019-12-12 13:39:27
问题 I looked up how to return the week number in Angular 2. I have not found an answer to this question. I did find on https://docs.angularjs.org/api/ng/filter/date that in Angular 1 it would be something like this: {{today | date:'w'}} but this does not seem to work in Angular 2. I know I can write a function to take care of this but this doesn't seem practical. Am I missing something in the documentation about Angular 2 or is this not (yet) implemented there? 回答1: The DatePipe currently doesn't