Edit report at http://bugs.php.net/bug.php?id=54253&edit=1

 ID:                 54253
 Comment by:         sunco007 at hotmail dot com
 Reported by:        sunco007 at hotmail dot com
 Summary:            Date H (and h) returns +7 hours
 Status:             Bogus
 Type:               Bug
 Package:            Date/time related
 Operating System:   Windows 7 x32
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Ok, in my case must add the line on common header file (the 100 files
was just an example)



Thanks for your time


Previous Comments:
------------------------------------------------------------------------
[2011-03-15 00:31:39] [email protected]

It does try to detect it. Many servers run in UTC by default, so yes,
you should 

set your timezone in your php.ini or if you don't have access to that in
some 

common include file.

------------------------------------------------------------------------
[2011-03-15 00:28:32] sunco007 at hotmail dot com

Ok. Your answer is the correct but..



Do i need to add that line to ALL my php files ? (lets say i have 100)



Ok.. i can change one line on php.ini but.. What about if I use a
hosting provider and they don't want to change it ?



I think is much better if Php reads the timezone directly from the PC,
just as Mysql does



What do you think about that ?

------------------------------------------------------------------------
[2011-03-15 00:03:06] [email protected]

Or I guess you are Pacific actually. Then use:



date_default_timezone_set('America/Los_Angeles');

------------------------------------------------------------------------
[2011-03-15 00:02:00] [email protected]

Set your timezone. You are getting UTC back.



date_default_timezone_set('America/Denver');

------------------------------------------------------------------------
[2011-03-14 23:58:07] sunco007 at hotmail dot com

Description:
------------
Want to get the date without any calculations and i got it wrong



Is 15:54:09 and Php..



date("H:i:s") returns me 22:54:09

date("h:i:s") returns me 10:54:09



Maybe you need to check exactly on March 14 2011 to see the same result
as me

Test script:
---------------
<?

echo date("H:i:s");

// or

echo date("h:i:s");

?>

Expected result:
----------------
Current time

Actual result:
--------------
The time +7 hours


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54253&edit=1

Reply via email to