paulmo Posted November 20, 2010 Share Posted November 20, 2010 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 More sharing options...
Dilated Posted November 20, 2010 Share Posted November 20, 2010 So Javascript time is better for user.It depends on what you're trying to do. If you're trying to create a user friendly app that doesn't necessarily need the time for any server side purposes, then yeah, I guess the timestamp from JS would be better. Link to comment Share on other sites More sharing options...
Fmdpa Posted November 20, 2010 Share Posted November 20, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.