This topic is locked

JavaScript for time

4/4/2023 7:42:05 PM
PHPRunner General questions
D
Dennis L author

I have added the following javascript in field events, but nothing happens.
img alt
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
console.log(dateTime)

Sergey Kornilov admin 4/5/2023

Ddi you really mean to use mouseover event? It doesn't look like something that is useful.
<ol> You need to make sure that the event is actually being executed. For this purpose you can add something like this to the beginning of this event:
</ol>console.log("here");
<ol start="2">
You need to make sure that your Javascript code that calculates date and time is correct. The easiest option is to set a breakpoint inside this code and proceed step by step inspecting Javascript variables after each line.
</ol>