Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
57
rated 0 times [  58] [ 1]  / answers: 1 / hits: 96821  / 7 Years ago, mon, june 12, 2017, 12:00:00

Hello every i have date field of type string with iso format like this:
const date = 2017-06-10T16:08:00: i want somehow to edit the string in the following format like this: 10-06-2017 but i'm struggling in achieving this.
I cut the substring after the T character


More From » string

 Answers
24

Use Moment.js and the .format function.



moment('2017-06-10T16:08:00').format('MM/DD/YYYY');


Will output



06/10/2017


Beside the format function Moment.js will enrich you will alot more useful functions.


[#57494] Thursday, June 8, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jocelyntrishar

Total Points: 48
Total Questions: 96
Total Answers: 83

Location: South Sudan
Member since Sun, Jul 11, 2021
3 Years ago
;