homer.favenir Posted January 23, 2009 Share Posted January 23, 2009 where does my script getting the date? is it on the server or in the client? <?php echo date("mm-dd-Y"); ?> thanks Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/ Share on other sites More sharing options...
DarkWater Posted January 23, 2009 Share Posted January 23, 2009 The server. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743914 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 im in the philippines, and my webhost is in the US. Phils date is ahead of 1 day in the US. e.g. phils current date = 01/23/2009 US current date = 01/22/2009 my problem is, my web application need real time for daily log. so i get a late date. what am i supposed to do? any advice? thanks Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743925 Share on other sites More sharing options...
DarkWater Posted January 23, 2009 Share Posted January 23, 2009 You can either change the PHP timezone to reflect your own, or get the date in Javascript and pass it into PHP. The former is probably going to be more elegant. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743928 Share on other sites More sharing options...
trq Posted January 23, 2009 Share Posted January 23, 2009 settimezone. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743930 Share on other sites More sharing options...
trq Posted January 23, 2009 Share Posted January 23, 2009 Actually, that should probably be date_default_timezone_set. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743933 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 but i dont have the php.ini, the admin of webhosting has it. can i just make a new php.ini and place it in my web application folder? Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743955 Share on other sites More sharing options...
rubing Posted January 23, 2009 Share Posted January 23, 2009 you don't need the ini file, just call the function at the top of your script. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743959 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 i paste date_default_timezone_set( "Asia/Manila" ); in my header. but there is an error Fatal error: Call to undefined function: date_default_timezone_set() in /home/mafeegro/public_html/tracker/header.php on line 132 Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743964 Share on other sites More sharing options...
rubing Posted January 23, 2009 Share Posted January 23, 2009 try: ini_set ( "date.timezone" , "Asia/Manila" ) Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743966 Share on other sites More sharing options...
daveoffy Posted January 23, 2009 Share Posted January 23, 2009 Whats line 132 if rubings post doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743967 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 Whats line 132 if rubings post doesn't work. date_default_timezone_set( "Asia/Manila" ); Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743973 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 try: ini_set ( "date.timezone" , "Asia/Manila" ) doesnt change the late date to my current date Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743977 Share on other sites More sharing options...
homer.favenir Posted January 23, 2009 Author Share Posted January 23, 2009 oh my gosh! my php configuration in cpanel is in "system default"!, i change it to php5, and page <?php ini_set( "date.timezone" , "Asia/Manila" ) ?> in my header.php now i have current time of my country.... thanks guys! youre all a great help! Quote Link to comment https://forums.phpfreaks.com/topic/142057-solved-is-date-in-server-or-in-client/#findComment-743978 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.