Jump to content

time zone problem


cherankrish

Recommended Posts

Hi need some help.have a iphone interface to schedule sms.my php scripts generate sms.people who are purchase this iphone app from different part of the world schedule sms.how can i generate sms to the correct time? iphone app should pass the timezone parameter to my php app? any idea?please help

Link to comment
Share on other sites

have the users fill choose their timezone, i.e. have a select box with +1 +2 etc, or the list of timezones, Sydney/Australia New York/USA etc.

then have their information/timezone stored in a database, and when they login you can have a code liek

//timezone php
putenv('TZ=Australia/Sydney');

 

and if you want to change the mysql timezone also,

//get offset, including daylight savings because mysql won't!
$currentOffset = "+".(date("Z") / 60 / 60).":00";

//timezone mysql
$update_tz = @mysql_query("SET time_zone = '$currentOffset'") or die(mysql_error());

 

so for that use the timezone would be australia/sydney and it would be stored in the database with their user details, and then when they log in that information would be retrieved from the database and the line

//timezone php
$sql = @mysql_query("SELECT timezone FROM users WHERE userid = 'whatever'");
$userDetails = mysql_fetch_array($sql);
$timezone = $userDetails['timezone'];
putenv("TZ=$timezone");

 

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.