javascript - Node.js server time instead of local device time -
i've been working on app working across 500 ipads , whilst testing across devices noticed times incorrect across of them, because using time device , not server. i'm new new date();
is there way can use server time instead? i'm new node, please forgive me if it's obvious!
update:
yes i'm trying display exact server time on devices, not time on local device. have looked around, couldn't find solid answers. again, apologies if have been vague, said, i'm new node.
this route(in node.js) helped me:
app.get('/', (req, res) => { res.send('<script>var r=new date().valueof() + ( ' + (new date().gettimezoneoffset()) + ' - (new date().gettimezoneoffset()) ) * -60000;' + 'setinterval(()=>{document.body.innerhtml = (new date(r+=1000)).tolocalestring("en",{weekday:"long", month:"long", day:"numeric", year:"numeric", hour:"numeric", minute:"numeric", second:"numeric", hour12:false})},1000);' + '</script>'); });
Comments
Post a Comment