I use the following pattern:
{{ item.EVPDATA | date: "dd.mm.yyyy HH:mm" }}
Value item.EVPDATA is UNIX time 1566473370:
I get formatted data as:
19.07.1970 07:07
Why I get wrong data?
As your data is in unix time, so before passing it to Date pipe you need to convert it to Date timestamp (by *1000), below code should work -
{{ (item.EVPDATA * 1000) | date: "dd.MM.yyyy HH:MM"}}
For more shorthand pipe values for Date you can refer -
Here are the docs for the DatePipe: https://angular.io/api/common/DatePipe
Have you tried this:
{{ item.EVPDATA * 1000 | date: 'EEEE, MMMM d, y, h:mm:ss a zzzz' }}
you can use custom pipe:
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: "mypipe"
})
export class MyPipe implements PipeTransform {
transform(unix: any): string {
const time = new Date(unix * 1000)
return time.toString();
}
}
{{ item.EVPDATA | mypipe }}
See the sample