PHP time question

When I key this in PHP:

echo strftime("%Y-%m-%d %H:%M:%S", time());

Open in new window

It somehow comes out 8 hours too much.

Can anyone tell me if I'm doing something wrong?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What timezone are you in.  If you do not specify a time zone it defaults to UTC.  So if you are on the US west coast that would be an 8 hour difference.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
elepilAuthor Commented:
Cd, that was it. I changed the date.timezone to America/Los_Angeles, restarted the server, and it was fine.

Thanks for your help!
I do it almost every time I do a new site; forget to set the time.

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Ray PaseurCommented:
No points for this, but just a thought... Why not standardize on UTC?  Then localize your time for each of your clients, based on where they are located.  Everyone can be happy, no matter where they live :-)
elepilAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for elepil's comment #a40659662

for the following reason:

Hmm... thought I already closed this. Sorry for the delay.
elepilAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.