Question Use app between 2 times and get the time from database

Valakik

Member
Joined
Nov 8, 2020
Messages
12
Programming Experience
Beginner
Hello
I am planning to make an app which could be used between defined times and if the time is not between the defined time then the app would give a warning and close the app.
Originally thinking about making a parental control app for parents and their kids so the parents can tell when it is enough.

I am using C# to make everything possible and I am using a database (MYSQL) to get the details.
The following are my questions:
Which way I should save in the database for different parents the timezone?
How I make the app to use that timezone which the parents defined?
If the parent will change the timezone while the app working and the time when the app can work then how the app will recognize that the data changed in the database?

I am newbie and I would be thankful for example or open source and some explanation if it is possible.
Thank you in advance all of the answers.
 
Always store your timestamps in UTC. The C# DateTime struct already naturally supports this, as well as getting the local time or timezones specific translation of the UTC time. And then separately store along with your users profile what time zone they are in. The timezone is only used for display purposes.

By keeping all your data in UTC you simplify all the time computations. Admitted, the down side of using UTC is that if you like scanning log files or console output, reading UTC time takes a lot of getting used to. (Simple example: try reading through the IIS logs when the logs are configured with the default settings to use UTC.)
 
Hmm so you are saying that I should save in the database in UTC way the parent's timezone and showing normally on the webpage or app the defined timezone.
In database should have 1 timezone which is used and when parents giving a timezone then it will be converted to timestamps in utc?
So 2 columns would be, one which showing the defined timezone and second which would be used to check the time.
If I understood correctly.

Just the part I don't get it yet is that how the app will recognize if the timezone or time is changed while the app working. Do I need use a timer event which would check the changes? Will it not make more heavy for slower pc?
 
Solution
Back
Top Bottom