EN
Dirask - JavaScript date and time templates and examples for posts creation
3
points
1. Example array with objects containing dates and equivalent timestamps
// ONLINE-RUNNER:browser;
const myList = new Array();
myList[0] = {};
myList[0]['date'] = '2022-02-04T10:00:00.000Z';
myList[0]['timestamp'] = 1643968800;
myList[1] = {};
myList[1]['date'] = '2022-02-05T10:00:00.000Z';
myList[1]['timestamp'] = 1644055200;
myList[2] = {};
myList[2]['date'] = '2022-02-06T10:00:00.000Z';
myList[2]['timestamp'] = 1644141600;
console.log(JSON.stringify(myList, null, 4));
// Output:
// [
// { date: '2022-02-04T10:00:00.000Z', timestamp: 1643968800 },
// { date: '2022-02-05T10:00:00.000Z', timestamp: 1644055200 },
// { date: '2022-02-06T10:00:00.000Z', timestamp: 1644141600 }
// ]