G
G
GreatX2019-09-03 12:16:39
JavaScript
GreatX, 2019-09-03 12:16:39

To receive on the client time from the server?

I want this function to be on the server and that I get time from there, but I can’t figure out how to access it. How can I do it? I just get that if people. will transfer the time to the computer, then everything is OK. How to organize all this correctly?

function timeOf(offset) {
    var d, utc, nd;
    d = new Date();
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);
    nd = new Date(utc + (3600000 * offset));
    return nd.toLocaleTimeString();
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bromzh, 2019-09-03
@GreatX

https://gist.github.com/ethaizone/6abb1d437dbe406fbed6

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question