Valakik
Member
- Joined
- Nov 8, 2020
- Messages
- 12
- Programming Experience
- Beginner
Hello
I don't find any information on the google how to do the following:
- I get from server side the server time through API. I load in DateTime one time when the form load completely.
- However I don't know from that point how the app will use that DateTime as normal date and time. What I mean is that the app wouldn't use the local time which is on the pc but the server time.
- I don't want to request everytime what is the realtime on serverside every 1 second because that would be heavy after long term to the webserver so I thought if the pc will get once the server time and from that point use that time and working as normal clock.
I tried with this and put in a timer with 100 interval but didn't even move the numbers:
How can make the app from the specific DateTime will functional as a normal date and clock?
I don't find any information on the google how to do the following:
- I get from server side the server time through API. I load in DateTime one time when the form load completely.
- However I don't know from that point how the app will use that DateTime as normal date and time. What I mean is that the app wouldn't use the local time which is on the pc but the server time.
- I don't want to request everytime what is the realtime on serverside every 1 second because that would be heavy after long term to the webserver so I thought if the pc will get once the server time and from that point use that time and working as normal clock.
I tried with this and put in a timer with 100 interval but didn't even move the numbers:
C#:
DateTime something = new DateTime((int)stuff.year, (int)stuff.month, (int)stuff.day, (int)stuff.hour, (int)stuff.minutes, (int)stuff.seconds);
var test = something.AddSeconds(1);
How can make the app from the specific DateTime will functional as a normal date and clock?