-1

I need to format my time field:

<span> {{reportBuilderObj.creationTimestamp  }}</span>

The output is:

2020-10-15T06:10:07.861+00:00

I tried to do it using below code, but it's not working either:

 <span> {{reportBuilderObj.creationTimestamp | filer : 'dd/mm/yyyy '}}</span>

I need to do below format to be:

2020-10-15

0

2 Answers 2

1

Just use the date pipe:

{{ timestamp | date:'yyyy-MM-dd' }}

See this working DEMO, using the values 1602845780824 as number and 2020-10-15T06:10:07.861+00:00 as string.

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

3 Comments

current my format is '2020-10-15T06:10:07.861+00:00' . but ur solution not working this output
my timestamp is in ms like so: 1602845780824
I have now tried with '2020-10-15T06:10:07.861+00:00' and its working for me
0

I would like to suggest you to use moment. Using moment you can easily perform any date and time operation

I.E

moment('2020-10-15T06:10:07.861+00:00').format('yyyy-MM-dd')

see moment

2 Comments

@price if u can do this without moment, big help
@gihankumara you can use angular default date pipe for formatting. please have a look on following link stackblitz.com/edit/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.