OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

converting dates into different format gives invalid date error in Angular

  • Thread starter Thread starter Flask Diploy
  • Start date Start date
F

Flask Diploy

Guest
I have a date which is like this "19/05/2020". I am trying to convert it into "yyyy-MM-dd" format using pipe. So the date should be look like "2020-05-19".

Code:
this._datePipe.transform("19/05/2020", 'yyyy-MM-dd');

It is giving me an error saying Unable to convert "19/04/2020" into a date' for pipe 'DatePipe

Also tried converting the string to date but again invalid date message is getting display.

Is there any way so that we can convert this date that is "19/05/2020" to a valid one so that we can perform datepipe on it.

<p>I have a date which is like this <code>"19/05/2020"</code>. I am trying to convert it into <code>"yyyy-MM-dd"</code> format using pipe. So the date should be look like <code>"2020-05-19"</code>.</p>
<pre><code>this._datePipe.transform("19/05/2020", 'yyyy-MM-dd');
</code></pre>
<p>It is giving me an error saying <code>Unable to convert "19/04/2020" into a date' for pipe 'DatePipe</code></p>
<p>Also tried converting the string to date but again invalid date message is getting display.</p>
<p>Is there any way so that we can convert this date that is "19/05/2020" to a valid one so that we can perform datepipe on it.</p>
 

Latest posts

M
Replies
0
Views
1
Mohit Pant
M
Top