• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# Use app between 2 times and get the time from database


New Coder
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.


What you can do is have a table in the database that contains all timezones, and in the user table, have a column that references the primary key of the TimeZone table. In your app, you can have a dropdown menu with all timezones with the id to every selection being the row number/primary key of the corresponding value in the table, and when the user selects their timezone, save their information along with the number of the selection to the users table