Checking and comparing Date and Time
Posted: Sat Sep 02, 2017 11:51 am
Hi everyone!
Me again with another - hopefully for this app atleast - last question.
In my app I only allow the user to do things in certain time spans. So for example: The user is only allowed to use the app on the first day inbetween 3pm and 5pm on the second day inbetween 9am and 11am and so on. Then on the seventh day the user isn't allowed to use the app anymore (it's a medical study, that's why)
What I'd do is to just lock the screen if the current date and time isn't one of those allowed times and otherwise he can answer the survey in my app.
What I kinda thought would be the way is that I save the date + time into two hidden fields when the user opens the app for the first time - that's my StartDate and StartTime. Then whenever the user opens the app I'd do a "on preopenStack"-command to check for the current date and time and compare it with my StartDate/StartTime - I thought of some switch-case-scenario kinda like "case actualdate = startdate+1" if that is the case then some "if-command" for the time-span.
But atleast as I tried it I didn't get it to work yet, so I was hoping that someone could give me some advise for this, how to do it better.
Thanks in advance!!
Me again with another - hopefully for this app atleast - last question.
In my app I only allow the user to do things in certain time spans. So for example: The user is only allowed to use the app on the first day inbetween 3pm and 5pm on the second day inbetween 9am and 11am and so on. Then on the seventh day the user isn't allowed to use the app anymore (it's a medical study, that's why)
What I'd do is to just lock the screen if the current date and time isn't one of those allowed times and otherwise he can answer the survey in my app.
What I kinda thought would be the way is that I save the date + time into two hidden fields when the user opens the app for the first time - that's my StartDate and StartTime. Then whenever the user opens the app I'd do a "on preopenStack"-command to check for the current date and time and compare it with my StartDate/StartTime - I thought of some switch-case-scenario kinda like "case actualdate = startdate+1" if that is the case then some "if-command" for the time-span.
But atleast as I tried it I didn't get it to work yet, so I was hoping that someone could give me some advise for this, how to do it better.
Thanks in advance!!