NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Time zone help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-31-2008, 10:42 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Aug 2008
Posts: 12
Exhale is an unknown quantity at this point
 



PHP Time zone help


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
????: NamePros.com http://www.namepros.com/programming/509550-php-time-zone-help.html

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
Exhale is offline  
Old 08-31-2008, 10:50 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



can you put in the function for xDate as well?
nasaboy007 is offline  
Old 08-31-2008, 11:07 PM   #3 (permalink)
NamePros Regular
 
sutuicom's Avatar
Join Date: May 2006
Location: Hangzhou, China
Posts: 453
sutuicom is a splendid one to beholdsutuicom is a splendid one to beholdsutuicom is a splendid one to beholdsutuicom is a splendid one to beholdsutuicom is a splendid one to beholdsutuicom is a splendid one to behold
 



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");
sutuicom is offline  
Old 08-31-2008, 11:17 PM THREAD STARTER               #4 (permalink)
New Member
Join Date: Aug 2008
Posts: 12
Exhale is an unknown quantity at this point
 



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?
Exhale is offline  
Old 09-03-2008, 05:50 PM THREAD STARTER               #5 (permalink)
New Member
Join Date: Aug 2008
Posts: 12
Exhale is an unknown quantity at this point
 



? anybody?
Exhale is offline  
Old 09-03-2008, 06:15 PM   #6 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



neither of those two, it'll be something like:
????: NamePros.com http://www.namepros.com/showthread.php?t=509550

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


also, did you try date_default_timezone_set("timezone"); like sutuicom suggested?
nasaboy007 is offline  
Old 09-04-2008, 12:10 AM THREAD STARTER               #7 (permalink)
New Member
Join Date: Aug 2008
Posts: 12
Exhale is an unknown quantity at this point
 



Where would i put that?
Exhale is offline  
Old 09-04-2008, 03:02 PM   #8 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



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.
nasaboy007 is offline  
Old 09-04-2008, 10:14 PM   #9 (permalink)
I'll do it
 
-Nick-'s Avatar
Join Date: Dec 2005
Location: India
Posts: 6,927
-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness-Nick- Has achieved greatness
 


Member of the Month
September 2007
Adoption
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
-Nick- is offline  
Old 09-05-2008, 01:04 AM THREAD STARTER               #10 (permalink)
New Member
Join Date: Aug 2008
Posts: 12
Exhale is an unknown quantity at this point
 



i tried the htaccess one but had no luck, And i tried adding the php one and it worked mint!

Thank you all!
Exhale is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:04 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger