0
votes

After selecting date from ngx-datepicker in Input box it shows properly DD/MM/YYYY but in form value its in another format 2018-06-29T07:46 :44.000Z

1
Well, you can use Angular DatePipe for that. Here is the link with relevant code samples. - mutantkeyboard

1 Answers

0
votes

This is called timestamp, it is used as a standard format of time, make a filter/service to convert it to your desired format by this code

GetFormattedDate() {
  const todayTime = new Date();
  const month = format(todayTime.getMonth() + 1);
  const day = format(todayTime.getDate());
  const year = format(todayTime.getFullYear());
  const final = day + "/" + month + "/" + year;
  console.log(final);
}

Or additionally , you can use moment library, which can do things for you, I hope ngx-datepicker must have the moment library just look for the appropriate function and use it.

https://momentjs.com/