Pergunta

I would like to use moment.js for date conversion.

Here's what I want:

var original_format = "Tuesday, May 22, 2012";

var output1 = "16 hours ago"
var output2 = "2012-05-22T00:00:00+02:00"

For the output1 no problem, for the second-one would it be possible to make it using moment.js?

moment("original_format").fromNow(); // "16 hours ago"
Foi útil?

Solução

moment("original_format").format();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top