JSFiddle - React, Tailwind, and code Playground
by Alee
HTML
<script src="http://underscorejs.org/underscore-min.js"></script>
<script type="text/template" id="tpl-1">
<% print(new Date(date*1000)) %>
</script>
<script type="text/template" id="tpl-2">
<%
var d = new Date(date*1000),
fragments = [
d.getDate(),
d.getMonth() + 1,
d.getFullYear()
];
print(fragments.join('/'));
%>
</script>
<script type="text/template" id="tpl-3">
<%= _.template.formatdate(date) %>
</script>
JavaScript
var timestamp = 1293683278,
l = 3;
var i, template;
_.template.formatdate = function (stamp) {
var d = new Date(stamp*1000),
fragments = [
d.getDate(),
d.getMonth() + 1,
d.getFullYear()
];
return fragments.join('/');
};
for (i=1; i<=l; i++) {
template = _.template($('#tpl-'+i).html());
$('body').append('<p>'+template({date: timestamp})+'</p>');
}