I have a scheduler program I am writing for a school project. The MySQL database is in UTC, the scheduler interface is in local time. I have everything working just fine, converting back and forth like it should, except that I am in PST, which is -8 hours.
Appointments that are set for after 4pm local time don't show up in the interface for that day, they show up on the next day. They show the correct day and time, but since I pull them from the database by comparing the database date, it believes they are the next day. (The interface in this case is a Visual Basic datagridview.)
How can I add those hours to the date before I compare it? Here is my query string:
STRING sqlString = "SELECT ADDTIME(START, '" + Global.OffsetString + "'),
ADDTIME(END, '" + Global.OffsetString + "')
FROM appointment
WHERE DATE(START) = '" + DateOnly + "' AND userId = " + Global.uNum;
I know using the offset number may not be the best, but it is a global variable that is run every time they start the program, and this is for a class project. I only have access to the user side, I can't affect the database at all, so I can't use the tz.
The biggest issue is that I don't know how to add (or subtract, I am at -8 hours) the hours, when I am only comparing dates. If I try to compare full DateTimes then nothing shows up because it is trying to compare minutes as well.
Any help would be greatly appreciated.