A
A
Anita Shah2017-10-27 13:24:24
JavaScript
Anita Shah, 2017-10-27 13:24:24

How to set date format in Node.JS?

Can anyone help set the date format in Node.JS? I tried a lot of time but I got error all the time. Could you please provide me the complete date format with code for Node.JS?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
lloydbanks, 2019-07-30
@Quintis_Mikeliy

Because your method matchdoes not find anything with an empty string.
Replace

var count = $('#js-myText').val().match(/\w{1,}/g);

on the:
var count = $('#js-myText').val().match(/\w{1,}/g) || 0;

A
Anita Shah, 2017-10-27
@appdevelopment

I'm a regular format like yyyy:mm:dd, Still not working.. :(

E
Eugene, 2017-10-27
@EShein

So you connect the library first and then indicate in what format you want, you were given a link.

var moment = require('moment');
var now = moment();
console.log(now.format('YYYYY: MM: DD'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question