Jump to content

Changing Time Zone - Confused!


saeed_violinist

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/28572-changing-time-zone-confused/
Share on other sites

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]
<?PHP

function 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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.