I used below code but getting one hour delay. Is it good approach to add one hour to it?
*todayISOString : any = new Date();
{{todayISOString | date:'h:mm:ss a': 'UTC-6'}}*
Actually I am looking for below time zone. Required Time Zone Image
I used below code but getting one hour delay. Is it good approach to add one hour to it?
*todayISOString : any = new Date();
{{todayISOString | date:'h:mm:ss a': 'UTC-6'}}*
Actually I am looking for below time zone. Required Time Zone Image
in angular you can use timezone time like this way
{{todayISOString | date:'short':'UTC +9:30 / +10:30'}}
{{todayISOString | date:'short':'GMT'}}
{{todayISOString | date:'short':'-0600'}}
{{todayISOString | date:'short':'UTC+4'}}
date formats are given below:-
medium: Sep 9, 2019, 12:35:54 PM
long: September 9, 2019 at 12:35:54 PM GMT+5
full: Tuesday, September 9, 2019 at 12:35:54 PM GMT+05:30
shortDate: 09/3/19
mediumDate: Sep 9, 2019
longDate: September 9, 2019
fullDate: Tuesday, September 9, 2019
shortTime: 12:35 PM
mediumTime: 12:35:54 PM
longTime: 12:35:54 PM GMT+5
fullTime: 12:35:54 PM GMT+05:30
these all are the different time zone example:-
Alpha Time Zone 'UTC+1'
Arabia Standard Time 'UTC+3'
Central Standard Time 'UTC-6'
China Standard Time 'UTC+8'
Delta Time Zone 'UTC+4'
Greenwich Mean Time 'UTC+0'
Gulf Standard Time 'UTC+4'
Hawaii Standard Time 'UTC-10'
India Standard Time 'UTC+4'
Offsets are not time zones.
I'm not an expert on North American time zones, but as far as I can see on timeanddate.com, both the US and Canada are currently observing the Central Daylight Time, which is at offset UTC -5. This is probably why an offset of -6 gives you a result which is one hour off from what you expect.
If you want your code to behave correctly on all days of the year, you should install a library with an actual time zone database, such as Moment Timezone. If you specify the time zone of an actual location which your users are in (e.g. "America/Winnipeg"), you will be able to calculate the time actually observed in that location, taking into account daylight saving time and any future political changes that might cause the time zone to change.