@yisrael-wix That worked! Thank you!
@poolshark314 If it is connected to a DateTime field in Data Collection it will display both date and time no matter what you do. Then you need to code the format you want.
@roi-bendet I think it should have toString()
$w(‘#date’).text = dateStr.toString();
I don’t understand why you added +1 in
let month = date.getMonth()+1;
Can you please explain? Thank you!
@wolftechnologiesin
Try to find it out by yourself by using CONCOLE-LOGs.
console.log(date.getMonth())
console.log(date.getMonth()+1)
do you recognize something?
You will find the results in your CONSOLE.
hey, what will happend in december? month will be 13?
@yaron71470 The Javascript Date object uses 0-based months. So, Jan is 0, Feb is 1, … Dec is 11. In order to display the correct month (as a number) on the screen, you need to add one.