/    Sign up×
Community /Pin to ProfileBookmark

date() giving the wrong time

So, I’ve been searching around trying to find the answer on my own, but I am now totally stumped. the date function is giving me a time that is 1 hour in the future. From my understanding PHP is getting the time from apache, but when I look at my apache logs, they all have the correct time listed, I am not changing my timezone anywhere by using date_default_timezone_set(). Any suggestions?
Thanks.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@coreillyauthorSep 02.2009 — Oh, I forgot to add, it is displaying the correct time zone and daylight savings time if I check it with [CODE]date("d M y H:i:s e I"[/CODE]
Copy linkTweet thisAlerts:
@NogDogSep 02.2009 — Is there a date.timezone setting in your php.ini (or .htacess)?
Copy linkTweet thisAlerts:
@coreillyauthorSep 02.2009 — There wasn't originally but I tried adding one to httpd in apache to correct it.

[CODE]SetEnv TZ America/Indianapolis [/CODE]

The oddest thing is, when I was doing some testing, I went to a page, then looked in my access log files on apache, and those timestamps were correct, but I'm still an hour ahead what the time should be in PHP
Copy linkTweet thisAlerts:
@coreillyauthorSep 02.2009 — I'd like to get the date() fuction returning the right thing but it also seems to be adding an hour if I manually try and create a time taken from a form.

[CODE]date("F j, Y H:i",strtotime($_POST['startDate']." ".$_POST['shr']. ":".$_POST['smin']))[/CODE]
That one is really driving me nuts.
×

Success!

Help @coreilly spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...