Jump to content

PHP time vs. JS time


paulmo

Recommended Posts

I'm getting PHP time from a server in TX which is 2 hours' difference. With Javascript time, it's browser time for every user, whereas PHP will only be user's time if they're in the TX time zone right? So Javascript time is better for user.

Link to comment
Share on other sites

PHP time has little or nothing to do with client-side, so it isn't the right tool for detecting the client's timezone. But to make things easier, you can pass a value to PHP's date_default_timezone_set(). I tried to make an automatic timezone detection system with JS/AJAX/PHP, but I could not find a reliable method of fetching the timezone && DST through JS. I'll probably just end up making a column in the user's table that holds their timezone offset.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...