saeed_violinist Posted November 26, 2006 Share Posted November 26, 2006 Dear friends,I have write a code to greet the time to visitors like this "today is monday, good after noon!"the code works fin but the problem is My visitors are +3.5gmt and the sever time is GMT!for example if the time is 3:20am in my coumtry, the server time is 11:50pm and the code will outpot : "today is sunday, goodafternoon" (BAD ONE)instead of showing : "todat is monday, good morning" (right one)I just want to have the time +3.5 hour gmt, and I dont want to use complex time scripts...thannks Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 26, 2006 Share Posted November 26, 2006 I know of no time zones that are 3 and a half hours from gmt they are all +/- integer hours Quote Link to comment Share on other sites More sharing options...
saeed_violinist Posted November 27, 2006 Author Share Posted November 27, 2006 a new one to learn ;) tehran, iran is +3.5GMT , even +3.5 GMT is listet in windows adjust date/time ok My script will work fine by +3 (without HALF), Jus how can I add it to my script, mys script is :[code]<?PHPfunction GreetDay() { $d= date('D'); $a= date('a'); if ($d=="Fir" and $a=="am") { return "happy your friday morning!"; } elseif ($d=="Fri" and $a=="pm") { return "happy your friday evenig"; } elseif ($d=="Sat" and $a=="am") { return "صبح شنبه شما بخیر"; } elseif ($d=="Sat" and $a=="pm") { return "عصر شنبه شما بخیر."; } elseif ($d=="Sun" and $a=="am") { return "صبح یکشنبه شما بخیر."; } elseif ($d=="Sun" and $a=="pm") { return "عصر یکشنبه شما بخیر."; } elseif ($d=="Mon" and $a=="am") { return "صبح دوشنبه شما بخیر."; } elseif ($d=="Mon" and $a=="pm") { return "عصر دوشنبه شما بخیر."; } elseif ($d=="Tue" and $a=="am") { return "صبح سه شنبه شما بخیر."; } elseif ($d=="Tue" and $a=="pm") { return "عصر سه شنبه شما بخیر."; } elseif ($d=="Wed" and $a=="am") { return "صبح چهارشنبه شما بخیر."; } elseif ($d=="Wed" and $a=="pm") { return "عصر چهارشنبه شما بخیر."; } elseif ($d=="Thu" and $a=="am") { return "صبح پنجشنبه شما بخیر."; } elseif ($d=="Thu" and $a=="pm") { return "عصر پنجشنبه شما بخیر."; } else { return "وقت شما بخیر."; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
mainewoods Posted November 27, 2006 Share Posted November 27, 2006 the easyest way to get the local time is to go client side javascript because that uses the users computers time setting. 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.