1

I am having a datetime with timezone offset in a span.

The span looks like this -

<span class="timestamp">2014-09-22 08:30:25 +0530</span>

Now with date.js I can convert it to local timezone of the browser using -

var $date = Date.parse($('.timestamp').html());
console.log($date.toString('yyyy-MM-dd HH:mm:ss'));

which converts the original time(IST) to the browser's time zone.

How do I do the same thing using moment.js

Best Regards

Pradyut Bhattacharya
  • 5,440
  • 13
  • 53
  • 83

1 Answers1

0

Nothing much to do here. Its done by default -

console.log(  moment( $('.timestamp').html() ).format('YYYY-MM-DD HH:mm:ss') );

I suppose this should be appended in the docs

Pradyut Bhattacharya
  • 5,440
  • 13
  • 53
  • 83