Page 1 of 1

date("r") shows a different timing!! :(

Posted: Fri Nov 24, 2006 3:15 am
by lmh85
it shows Fri, 24 Nov 2006 09:13:08 +0000
when the current time is 5.15pm
anyone?

Re: date("r") shows a different timing!! :(

Posted: Fri Nov 24, 2006 6:23 am
by Chris Corbyn
lmh85 wrote:it shows Fri, 24 Nov 2006 09:13:08 +0000
when the current time is 5.15pm
anyone?
That's the time on the server. The server must be based in the UK. Where are you?

Posted: Fri Nov 24, 2006 8:42 am
by feyd
The difference would suggest GMT+6 so that's Dhaka, Bangladesh.

Posted: Fri Nov 24, 2006 9:01 am
by onion2k
09:13 + 6 hours is 15:13. He said it's 17:15 ... +8 hours.

Posted: Fri Nov 24, 2006 9:15 am
by feyd
whoops.. my math of off from all the turkey I guess.

Posted: Fri Nov 24, 2006 5:12 pm
by aaronhall

Posted: Mon Nov 27, 2006 7:24 am
by lmh85
hey everyone! thanks for the reply! i'm from singapore.. i had tried "date_default_timezone_set" but it can't work as well! i can't get access to the server which is also located in singapore.. :roll: :?: :( :cry:

Posted: Mon Nov 27, 2006 11:38 am
by aaronhall

Posted: Mon Nov 27, 2006 6:45 pm
by lmh85
the version of my php is 4.. so, i'm not able to use the date_default_timezone_set.. is there any other way?

Posted: Mon Nov 27, 2006 7:15 pm
by aaronhall
Try

Code: Select all

putenv("TZ=Etc/GMT+8");

Posted: Thu Nov 30, 2006 7:54 pm
by lmh85
can't work either.. It sort of messed up my session variables :(

Posted: Thu Nov 30, 2006 9:25 pm
by aaronhall
You could always alter your timestamp, but you would have to do it every time you called date:

Code: Select all

date('r', time()+(8*60));

Posted: Fri Dec 01, 2006 9:41 am
by lmh85
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

function fnc_date_calc($this_date,$num_days,$display){
	$my_time = strtotime ($this_date); //converts date string to UNIX timestamp
	$timestamp = $my_time + ($num_days * 86400); //calculates # of days passed ($num_days) * # seconds in a day (86400)
	if($display==1){
	$return_date = date("d-m-Y",$timestamp);  //puts the UNIX timestamp back into string format
	}else{
	$return_date = date("Y-m-d",$timestamp);  //puts the UNIX timestamp back into string format
	}
	
	return $return_date;//exit function and return string
}//end of function
i'm having this function.. which adds num days if i call it. It do work fine in my developing machine.. But not my web server.. Is there any one whom can help?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Dec 01, 2006 10:10 am
by aaronhall
If this isn't related to your previous post, start a new thread..

Posted: Fri Dec 01, 2006 10:15 am
by lmh85
okok.. Thanks.. I thought it was about the same! So sorry!