Eric Zebrowski
Eric Zebrowski

Reputation: 13

PHP DateTime Subtraction and Conversion

It's hard to articulate the problem I'm having in the title, but here's the scenario: I'm working the backend of a 3-tiered exam taking website. I'm currently updating my function used for when students request an exam. The exam has start and end dates and times, as well as a time limit. What I want to do is specific to the case when the amount of time left in the exam period is less than the time limit for the exam, For example, the exam period ends at 5:00PM. The time is now 4:30PM. The exam time limit is an hour and a half. I want to replace the hour and a half time limit with 30 minutes. To do that, there are 3 dates I need, and I will explain how I get each:

If there is a better way of doing this, I'd be much obliged to know. I'm fairly new to php, and admittedly I realize this may be a strange problem, but that's the way the group decided to go.

Upvotes: 0

Views: 267

Answers (1)

Hawaiyon
Hawaiyon

Reputation: 31

Maybe it's because the databse and PHP server are using different timezones. Check it out by printing these variables to see their values.

Upvotes: 1

Related Questions