digitalgod Posted August 9, 2006 Share Posted August 9, 2006 hey guys,trying to make a drop down that displays the days of the week starting by today but if it's past 9:15pm it shows the next day. I was wondering if I do something like [code=php:0] date('h:i:s a') [/code] would a user be able to "cheat" by changing the time on his taskbar?Also how can I set the time to Eastern time all the time no matter where the user is from? Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 9, 2006 Share Posted August 9, 2006 [quote author=digitalgod link=topic=103596.msg412618#msg412618 date=1155148937]hey guys,trying to make a drop down that displays the days of the week starting by today but if it's past 9:15pm it shows the next day. I was wondering if I do something like [code=php:0] date('h:i:s a') [/code] would a user be able to "cheat" by changing the time on his taskbar?Also how can I set the time to Eastern time all the time no matter where the user is from?[/quote]PHP is a server-side language. The date() and time() functions use the server's current date. Quote Link to comment Share on other sites More sharing options...
bltesar Posted August 9, 2006 Share Posted August 9, 2006 because the date/time functions are executed on the server side, they will be independent of the client's machine settings. To always have eastern time, you need to find out the time zone of your server and adjust accordinglye.g. date('h:i:s a', time()+3600); to add an hour to your server time. Quote Link to comment Share on other sites More sharing options...
digitalgod Posted August 9, 2006 Author Share Posted August 9, 2006 k thanks guysjust another question thoughI have this [code=php:0]$days = array();for ($i=1;$i<=7;$i++) { array_push($days,date("l", mktime(0,0,0,0,+$i,0)));}echo "<select name='days' ><option value=''>Select one</option>";for($i=0;$i<=count($days);$i++) { echo '<option value='.$days[$i].'>'.$days[$i].'</option>';}echo "</select>";[/code]that's supposed to display all the days from today till next tuesday but for some reason it adds a blank choice after tuesday, any reason why?I know how to make it work, all I need to do is to replace the <= by <count($days).... never mind my brain isn't all there today by using <= it will loop 8 times instead of 7 Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 9, 2006 Share Posted August 9, 2006 have you tried checking what's actually in the $days array? Quote Link to comment Share on other sites More sharing options...
digitalgod Posted August 9, 2006 Author Share Posted August 9, 2006 yeah I did, it works perfectly akitchin, I'm just tired that's all :P Quote Link to comment Share on other sites More sharing options...
bltesar Posted August 9, 2006 Share Posted August 9, 2006 instead of <=count($days), you should have <count($days) Quote Link to comment 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.