Reputation: 181
I'm trying to convert the time and date from an html5 input to our countries format.
I'm trying to convert this: 2018-05-23 03:00 To this: 23-05-2018 03:00
I'm using angulars DatePipe like this:
var newDateBegin = this.dateFilter.transform(this.newDateBeginString.replace("T", " "), "dd-MM-yyyy HH:MM");
I have to replace the T in the string because for some reason the HTML5 input outputs it like this: 2018-05-23T03:00
But after converting it using: 2018-05-23 03:00, i get the following result: 2018-05-23 03:05. No matter what time I put in there it always ends with xx:05. Am I missing something?
this is how i create the DatePipe:
private dateFilter: DatePipe = new DatePipe("nl-NL");
Upvotes: 0
Views: 238
Reputation: 8075
Isn't HH:MM the problem? M (uppercase) gets the month. Try to change it.
Month - MM - Numeric: 2 digits + zero padded
Use mm, as explained here
"dd-MM-yyyy HH:mm"
Upvotes: 2