Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
is there a way to get the latest timestamp entry from an InfoTable which has around 20 timestamps rows?
Thanks,
Solved! Go to Solution.
hi @Velkumar ,
Thanks for it; I am not sure how I missed it.
let sort = {
name: "timestamp",
ascending: false
};
result.Sort(sort);
Thanks,
Hello @pshashipreetham,
Here is some code that should do what you want:
// if your dates are strings
let objects = [
{ date: "2023-04-19" },
{ date: "2023-04-20" },
{ date: "2023-04-21" },
];
let newestDate = new Date(
Math.max.apply(
null,
objects.map(function (obj) {
return Date.parse(obj.date);
})
)
);
result = newestDate.toDateString(); // Output: Fri Apr 21 2023
// if your dates are dates
let objects = [
{ date: new Date("2023-04-19T12:00:00Z") },
{ date: new Date("2023-04-20T12:00:00Z") },
{ date: new Date("2023-04-21T12:00:00Z") },
];
let newestDate = new Date(Math.max.apply(null, objects.map(function(obj) {
return obj.date.getTime();
})));
result = newestDate.toDateString(); // Output: Fri Apr 21 2023
Hope this helps.
Regards,
Jens
hi @Velkumar ,
Thanks for it; I am not sure how I missed it.
let sort = {
name: "timestamp",
ascending: false
};
result.Sort(sort);
Thanks,