0

I am using date to display my date on html like:

{{updateDate| date: 'dd/MM/yyyy HH:mm:ss'}}

Dates are all saved in UTC. The problem is it displays the date in locale timezone but not considering Daylight saving on/off. As in for BST it always shows +1 hr from UTC. I want it to also consider DST(daylight saving time). Any help, please.

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
DS2020
  • 279
  • 1
  • 4
  • 20
  • 1
    Have you tried using momentjs or try [this](https://stackoverflow.com/questions/11887934/how-to-check-if-the-dst-daylight-saving-time-is-in-effect-and-if-it-is-whats) – amansinghgusain Jun 20 '18 at 10:55

1 Answers1

0

{{ date_expression | date : format : timezone}}

As per angular date filter documentation:

date: Here date can be Date Object, milliseconds or ISO 8601 datetime string formats (like: e.g. yyyy-MM-ddTHH:mm:ss.sssZ). Here Z is 4 digit (+sign) representation of the timezone offset (-1200-+1200). If no timezone is specified in the string input, the time is considered to be in the local timezone.

format: this is optional, If not specified, mediumDate(equivalent to 'MMM d, y' for en_US locale (e.g. Sep 3, 2010)) is used.

timezone: Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used.

This may help you.