I would like to show a date and time label if auto detect timezone is too difficult…
then I would atleast like the the option of selecting the timezone and have the server send me the time and date, to use those on a text label on a webpage and gets updated live probbaly every minute accuracy is preferred, is this possible using the built in server response, I am new to Velo editor, has anyone tried to achieve this?
Hey Deepak,
If I understand you correctly you want to display the time in the visitor’s timezone.
If you use javascript’s Date object this should achieve what you want,
check this out, it’s supposed to answer your questions:
I am aware of the function in javascript, but it would really be helpful if someone were to point me towards an implementation of the date and time function using the corvid interface with a tiny demo using editor x labels.
If it’s not too much trouble, but thank you for thesuggestionn, appreciate it
https://idoh33.editorx.io/mysite-12
$w.onReady(function () {
updateTime();
});
function updateTime() {
setInterval(()=>{
let date =new Date();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
$w('#text3').text = hours+':'+minutes+':'+seconds;
},1000)
}
Amazing Ido you came to the rescue! The function seems so straight forward and easy to understand, It’s been 5 years since I did any JS coding, so I feel little apprehensive to experiment, hopefully that change soon!
Thank you for helping me, I’ll try it out today and let you know how it goes
Ido, hello, I’m currently trying out the Updatetime function, I have to add a text label to the page and then assign the ID to the function? I have done that but the label seems to be not displaying in the page, am I missing anything here?
Hey Deepak, can you send the url of your site?
@deepakkumar99933
Hey,
So I checked it out, the function is working just fine, the reason why you are not seeing the label is because you added it to one of your lower breakpoints (1001-1280) , and because of the cascading rule in editor X you see it only from this breakpoint and down. when you preview look at the lower breakpoints and you will see the label and the time running. if you look in the layers panel while you are in the higher breakpoints you will see the text element with the “not displaying” icon next to it if you press it will make display on these breakpoints as well.