Jump to content

Selecting date based on user and server time zones


djones

Recommended Posts

I'm inserting/displaying date/time based on this flow:

 

INPUT

User input -> convert to server time -> insert date/time into table

 

OUTPUT

select date/time from table -> convert to user's date/time - > display date/time to user

 

The above part works great until I need the events for a full day.

 

My problem is when I need to get events based on a day, month, year and not the time. I need to get the full days events.

 

If a user picks Jan, 28th 2010 at 00:00:00 time it will insert into the table for the 27th 23:00:00 (server time).

 

When I query the database or events on the 28th I do not have the time. Only the month,day,year. So  its looking for events on the 28th when it was inserted as 27(server time). How can I get around this?

 

Link to comment
Share on other sites

I got lucky and tried to use the time offset from each timezone in seconds then use DATE_ADD/DATE_SUB based on the integer and corrected the time in the SQL statement to relfect the user's timezone. And it worked. Shew.... timezones area a headache. Went ok up until this point.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.