I've set an event listner on an 'li' element which contains a span element that should output the current date.
I have the following lines of code:
var date = new Date();
date.setTime(e.timeStamp);
var showDate = date.toDateString();
$(this).append('<span class="date-clicked">' + showDate + '</span>');
the idea is to use the event objects 'timeStamp' property to obtain the number of milliseconds from Jan 1st 1970 (epoch/unix time) and then using var showDate to get the right date format to display in the span element inside the respective li element.
I'm using firefox btw.
Each time I click an li element its showing me the epoch time 'Thu Jan 01 1970' instead of what i want to see which is 'Thu Feb 13 2020'.
is there a way I can get e.timeStamp to show me the CURRENT Date instead of the epoch/unix date ?
any pointers or tips in the right direction appreciated folks. Thanks.