Reply
Require Assistance - Time Offset Script
Old 03-23-2006, 10:15 AM Require Assistance - Time Offset Script
Junior Talker

Posts: 2
I'm hardly a PHP pro, in fact, I'm hardly even good enough to be considered a novice. Yet, I still need assistance with creating a certain script.

On my website, I have a schedule of the different shows that air on the NHB Radio Network, but the schedule is only in EST. I would like some help on creating a script that will allow one to select one's timezone from a drop-down list, save said selection in a cookie (or file or mySQL), and then, depending on one's selection, adjust the schedule to show the times according to the selected timezone. The script will need automatic DSL-adjustment, as well as a way to adjust PM, AM, and the day (for some, Sunday 8:00 PM - 10:00 PM would be Saturday 11:00 PM - 1:00 AM and for others, maybe Monday 12:00 AM - 2:00 AM). I'll admit that I don't know squat about this kind of thing, and all the other forums that I've requested help in haven't replied (or at least not with anything really helpful). I would greatly appreciate it if someone could figure out how to make this script work.

I thank you for your time.
Cerebral Stasis is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-26-2006, 07:25 AM Re: Require Assistance - Time Offset Script
danlefree's Avatar
Skilled Talker

Posts: 61
My best recommendation would be to display times with Javascript after setting the server time (years, months, days, hours, seconds) up in Javascript variables - this way, even if the user changes his or her machine's clock, the times will be displayed correctly (although you may need to do some CSS work to hide the textbox elements the times will be displaying in).

Resource:
http://www.web-source.net/web_develo...cript_date.htm

PHP + Javascript code sample:
PHP Code:
<script type="text/javascript">

// Grab server times to calculate differential

var servYear = <?php echo date("Y"); ?>;
var servMonth = <?php echo date("m"); ?>;
var servDay = <?php echo date("d"); ?>;
var servHour = <?php echo date("H"); ?>;
var servMinute = <?php echo date("i"); ?>;
var servSecond = <?php echo date("S"); ?>;

// Grab user times to calculate differential

var userYear = now.getYear();
var userMonthNumber = now.getMonth();
var userMonthDay = now.getDate();
var userHour = now.getHours();
var userMinute = now.getMinutes();
var userSecond = now.getSeconds();
</script>
__________________
DAN LEFREE CONSULTING || HADEAN LLC
danlefree is offline
Reply With Quote
View Public Profile Visit danlefree's homepage!
 
Reply     « Reply to Require Assistance - Time Offset Script
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10693 seconds with 12 queries