Risakval Posted June 23, 2011 Share Posted June 23, 2011 Hello: I am trying to get a schedule to work on our site. We enter the schedules in admin in EST. When a visitor comes to the site the schedule shows in his/her time zone. It works perfectly. Except...if a show on the schedule starts at 12AM Friday EST it should display 9:00PM Thursday PST. Instead it shows 9PM Friday PST. In other words the time is rolling back but not the day. I know it is difficult without looking at the code...but here is the page: http://risaradio.com/index.php/risaradio-schedule. Maybe someone out there has done this before and has a solution. Thank you!!! Quote Link to comment https://forums.phpfreaks.com/topic/240224-php-schedule/ Share on other sites More sharing options...
efficacious Posted June 23, 2011 Share Posted June 23, 2011 try using just a time stamp of secs and then converting the time just before you output to the display forcing PHP to handle the conversion. $MyTimeStamp = time(); $UserTimeZone = "America/Denver"; date_default_timezone_set($UserTimeZone); $Time_Day = Date("H:i:s Y-m-d", $MyTimeStamp); echo($Time_Day); i actually just had done something like this.. where I needed the time to be changed based on the clients timezone.. so I had to write a Javascript function to find that timezone automatically and pass it to PHP incognito style. Quote Link to comment https://forums.phpfreaks.com/topic/240224-php-schedule/#findComment-1233931 Share on other sites More sharing options...
Risakval Posted June 23, 2011 Author Share Posted June 23, 2011 try using just a time stamp of secs and then converting the time just before you output to the display forcing PHP to handle the conversion. $MyTimeStamp = time(); $UserTimeZone = "America/Denver"; date_default_timezone_set($UserTimeZone); $Time_Day = Date("H:i:s Y-m-d", $MyTimeStamp); echo($Time_Day); i actually just had done something like this.. where I needed the time to be changed based on the clients timezone.. so I had to write a Javascript function to find that timezone automatically and pass it to PHP incognito style. Thank you I appreciate your assistance. I think with what you have it will still not change the day. The time yes. Again, 12AM Thurs is 9PM Wednesday...and it will not make the day conversion....it changes the time to 9PM Thursday which of course is not correct. . Quote Link to comment https://forums.phpfreaks.com/topic/240224-php-schedule/#findComment-1234006 Share on other sites More sharing options...
efficacious Posted June 23, 2011 Share Posted June 23, 2011 it should do exactly what your wanting.. time Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). if you are changing the default time zone before using the date() function then it should be fine. did you test it? Quote Link to comment https://forums.phpfreaks.com/topic/240224-php-schedule/#findComment-1234051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.