Is it possible to use code to have a page greeting of Good Morning / Good Afternoon or Good Evening, I know it should be possible using the clock data but cannot figure it out.
Cheers
Is it possible to use code to have a page greeting of Good Morning / Good Afternoon or Good Evening, I know it should be possible using the clock data but cannot figure it out.
Cheers
You can probably find some javascript code snippets on stackoverflow and then paste it on the html component.
Hi, I tried that but couldnt get it to work, thought someone might have already come across the problem, I will try it again. Cheers
PseudoCode:
if time between 6:00 and xx:xx then textelement.value = “Good Morning”
…
…
I have the code of the clock plus the rest I do not know how to do, good idea.
//Current time.
$w.onReady(function () {
setInterval(function () {
var intervalo = new Date();
let hor = (String(intervalo.getHours()).length === 1 ?
"0"+intervalo.getHours() : intervalo.getHours())
let min = (String(intervalo.getMinutes()).length === 1 ?
"0"+intervalo.getMinutes() : intervalo.getMinutes())
let sec = (String(intervalo.getSeconds()).length === 1 ?
"0"+intervalo.getSeconds() : intervalo.getSeconds())
var tempo = hor + ":" + min + ":" + sec;
$w('#text52').text = ""
$w('#text52').text = tempo
}, 1000);
});
It would be a good idea to put this on the home page or the member profile page.
If you can, let me know if you have succeeded. ^^
Hi,
You can use the Date() function to get the current hour and display a text according to the time.
Good luck
This does not seem to work on my site could you help me with getting this to work because it will not display on the text that I want it to.