0

I am working on an application (zend framework) in which user can create their event and invite other users. Its current time zone is set to IST. But when any user from other country like USA, UK create an event its shows event expired because of its current time zone.

Is there any way to set time zone dynamically on bases of country ? Can we get timezone of any location using php ? Please guide me in right direction.

Many Thanks,

M.

Amit Kumar
  • 3,384
  • 6
  • 25
  • 42
  • You haven't really provided enough information about what you're doing in the code... that makes it hard to help you. What do you mean by "set time zone"? It sounds like you want to perform *conversions* between time zones rather than anything else... – Jon Skeet Apr 07 '15 at 14:35
  • I want to get timezone dynamically using php. If site is opened in USA then how to get time zone of USA dynamically in php? – Amit Kumar Apr 07 '15 at 14:37
  • So you're asking how to determine the client's time zone in a web application? If so, there's probably a duplicate for that... – Jon Skeet Apr 07 '15 at 14:38
  • @jon: Are you getting me? – Amit Kumar Apr 07 '15 at 14:38
  • what do you mean by duplicate for that? – Amit Kumar Apr 07 '15 at 14:40
  • 1
    I mean there are already questions on SO for that. – Jon Skeet Apr 07 '15 at 14:41
  • okay..i'll serach for it.. Thanks Jon:) – Amit Kumar Apr 07 '15 at 14:44
  • 1
    No need to search - I closed this question as a duplicate of another, so it's linked at the top now.. – Jon Skeet Apr 07 '15 at 14:48
  • @JonSkeet It's not actually a duplicate of this one. Question here is about dealing with time zones in general, the one you linked to is about detecting user's time zone. – Michal M. Apr 09 '15 at 12:40
  • @M.M.: Not if you read the comments. "If site is opened in USA then how to get time zone of USA dynamically in php?" for example. If the OP wants *more* than getting the time zone, they need to specify exactly what there is after that. – Jon Skeet Apr 09 '15 at 13:40
  • @jon: I have viewed the original post but its not helpful to me. Its all javascript code and we cant rely on this code as i need to convert and display event time(Which is in GMT right now) to clients local time zone eg. IST – Amit Kumar Apr 11 '15 at 12:59
  • @Maverick: "we cant rely on this code" - well that's pretty much the only code you're going to be able to run on the client, so how else do you expect to be able to determine the client's time zone? Basically in a web app, your options are detecting it with Javascript, asking the user to enter it manually, or detecting it via IP address (which is pretty unreliable). I'm not suggesting that the conversion should be done in Javascript - you use Javascript to inform the server what the local time zone is. – Jon Skeet Apr 11 '15 at 13:13

0 Answers0