-1
Good morning, I created an input datatime but it returns me the date as follows:2019-04-26T11:43:17Z, and the database does not accept this format, I needed it to return so: 26/04/2019 11:43:17. How do I do this formatting ?
-1
Good morning, I created an input datatime but it returns me the date as follows:2019-04-26T11:43:17Z, and the database does not accept this format, I needed it to return so: 26/04/2019 11:43:17. How do I do this formatting ?
1
You can use the library Moment js.
moment('2019-04-26T11:43:17Z').format('DD/MM/YYYY HH:mm')
Browser other questions tagged ionic typescript
You are not signed in. Login or sign up in order to post.
guy worked out, thanks! however the time is he returning wrong, puts some random times
– israel
is returning 3hrs earlier than is received, for example if the person type 12:00:00 returns 9:00:00
– israel
tries for . toISOString() on its date before formatting with format
– Isaías de Lima Coelho
how the syntax would look, knowing that my date I take from this.inputs.data ?
– israel
this.inputs.data.toISOString()
– Isaías de Lima Coelho
Says toISOSString() is not a function, but quiet, already helped me a lot!
– israel
Oops, man, what kind of your this.inputs.data ? if it’s implementing the Date interface it should have that function. What is happening is that your date is being "converted" in UTC. I don’t know if it’ll work out, but you can put Z in your format, so : Moment('2019-04-26T11:43:17Z'). format('DD/MM/YYYYYY HH:mm Z')
– Isaías de Lima Coelho