0๐
// Assuming your Unix Timestamps are stored in the `timestamp` column
const data = [
{ timestamp: 1629889200 },
{ timestamp: 1630158600 },
];
data.forEach(item => {
item.formattedDate = new Date(item.timestamp * 1000).toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
});
});
//Display in JSpreadSheet:
jspreadsheet(document.getElementById('spreadsheet'), {
data: data,
columns: [
// ... other columns
{
title: 'Formatted Date',
data: 'formattedDate'
}
]
});
Source:stackexchange.com