NameSilo

PHP Time zone help

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Exhale

Established Member
Impact
0
So i am running xZero classifieds, and i am trying to set it up so that the time is for Mountain Standard. I want to know if this is possible by editing anything here? Basically, its the time function that everything else goes to, i do believe

Code:
function QuickDate($timestamp, $showtime=TRUE, $gmt=FALSE, $format="")
{
	if(!$format)
	{
		if($showtime) $format = $GLOBALS['langx']['datetimeformat'];
		else $format =  $GLOBALS['langx']['dateformat'];
	}

	return xDate($timestamp, $gmt, $format, $GLOBALS['langx']['months'], $GLOBALS['langx']['weekdays']);
}

Thanks in advance
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
can you put in the function for xDate as well?
 
0
Close
You can use date_default_timezone_set() to set the default timezone used by all date/time functions in a script (PHP >= 5.1.0).

eg:
date_default_timezone_set("America/Phoenix");
 
0
Close
Not sure which one it would be, but here is a few of the ones i found

Code:
	if ($_GET['date']) $xdate = $_GET['date'];
	else $xdate = date("Y-m-d");


Code:
	preg_match("/([0-9]+)-([0-9]+)-([0-9]+)/", $xdate, $dp);
	$xdatestamp = mktime(0, 0, 0, $dp[2], $dp[3], $dp[1]);
	$xdate_y = $dp[1];
	$xdate_m = $dp[2];
	$xdate_d = $dp[3];

either of those?
 
0
Close
? anybody?
 
0
Close
neither of those two, it'll be something like:

PHP:
function xDate($arg1 ... etc) {
//function
}


also, did you try date_default_timezone_set("timezone"); like sutuicom suggested?
 
0
Close
Where would i put that?
 
0
Close
just stick it in the file all the way at the top where you got the code from your FIRST post from. see if it does anything.
 
0
Close
It isn't about PHP for setting a fixed timezone. [There might be one but I prefer other way round]

You can set the timezone from .htaccess file ;)

Code:
SetEnv TZ America/New York
 
0
Close
i tried the htaccess one but had no luck, And i tried adding the php one and it worked mint!

Thank you all!
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back