moment.js to format date from string timestamp
HTML
<script src="https://rawgithub.com/moment/moment/2.2.1/min/moment.min.js"></script>
<script src="https://rawgithub.com/moment/moment/2.2.1/min/moment+langs.min.js"></script>
<span id="date"></span>
JavaScript
var timestmp = "1521939127";
var x = 1000 * 1537274725;
var now = moment(parseInt(x)).format("YYYY-MM-DD HH:mm:ss");
// Saturday, June 9th, 2007, 5:46:21 PM
$('#date').append(now);