简体   繁体   中英

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?

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'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM