0

I know how to display the DateTime in angular using by pipe

{{ dateObj | date:'medium' }} 

How to display the GMT time using a pipe

Ratan Uday Kumar
  • 5,738
  • 6
  • 35
  • 54

1 Answers1

2

You can achieve the above by making the following changes:

{{ today | date : 'medium':'GMT' }}

According to the DatePipe documentation,

The 2nd parameter refers to the timezone. Therefore, you can simply just pass 'GMT' to your expression, and it should transform the date values to the required timezone.

A timezone offset (such as '+0430'), or a standard UTC/GMT or continental US timezone abbreviation. Default is the local system timezone of the end-user's machine.

{{ value_expression | date [ : format [ : timezone [ : locale ] ] ] }}
wentjun
  • 40,384
  • 10
  • 95
  • 107