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
https://forums.phpfreaks.com/topic/199350-time-zone-problem/
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
https://forums.phpfreaks.com/topic/199350-time-zone-problem/#findComment-1046269
Share on other sites

Archived

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

×
×
  • 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.