1

I currently get the following UTC date from my web API. "2018-04-05T11:50:37.6173487Z"

I wanted to display it as such 05.04.18 11:50 UTC However, using {{ResponseTime| date:'dd.MM.yy HH:mm'}} id displaying 05.04.18 13:50. It seems that the pipe automatically converts the date to my timezone which is UTC+2. How should I do to display my date in the UTC timezone?

0

1 Answer 1

-1

Use Date Pipe!

import the following

import { DatePipe } from '@angular/common';

Declare in the constructure as well

 constructor( private datePipe: DatePipe ) {}

then use like this

var example = this.datePipe.transform(Date(),'yyyy-MM-dd HH:mm:ss');

you can use any format you need or if you have a date string you can replace the Date() and will do the same

var date = "01/01/2018";
var example2 = this.datePipe.transform(date, 'yyyy-MM-dd HH:mm:ss');

Good luck!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.