0

i'm simply trying to get the current date in PHP, but it's getting '07:45:23' when it's really 11:02am (the date part of it is correct). i am setting the timezone like this:

date_default_timezone_set('America/New_York'); 
$now = date('Y-m-d H:i:s');

why isn't this working? i also tried 'EDT'. and if it matters, the server is also in the same timezone.

thanks.

1
  • 1
    one possibility is that your server clock might be off... is your server linux? Commented Dec 15, 2010 at 16:14

2 Answers 2

1

Your server's time is likely incorrect. If you have SSH access, running date will show you what the server is set to.

Sign up to request clarification or add additional context in comments.

1 Comment

yes, that was the issue. solved by running: date --set='Wed Dec 15 02:00:00 EST 2010' . thanks!
1

Is the servers time set properly?

2 Comments

Eh, the answer is implied in the post.
@ceejayoz technically, the answer is a question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.