reza
reza

Reputation: 6358

How to reformat times in javascript?

I have dates in YYYYMMDDHHmmss and I need to translate that to say Jun 6 - HH:mm

I can write a lookup table for the month conversion and code the whole thing myself. Is there a better way to go using standard javascript or node utilities?

Upvotes: 0

Views: 39

Answers (1)

Vitaliy Hnatyk
Vitaliy Hnatyk

Reputation: 46

You will look into on https://momentjs.com/ I used on nodejs

for exemple:

console.log(moment("201710022233322","YYYYMMDDHHmmss").format('YYYY-MM-DD HH:mm'));

Upvotes: 1

Related Questions