Within a loop, that otherwise works fine, the_time() is giving me a date and time about 25 days and a few hours ahead of the actual date.
For instance, if I post today, it lists it as "April 30th, 2013" (today is April 6th, 2013).

I can't for the life of me figure out why it's doing this.

A couple things: This is on the front-end of my site and I am looping through a users posted attachments (sort of like a front-end media manager). The loop is working fine to grab the thumbnail, the attached post (and it's date), etc but the time of the actual upload of the file is just not right.

That being said, the date/time that lists in the wp-admin section is correct, which is even more confusing...

Pastebin of the entire page


if I post today, it lists it as April 30th, 2013 (today is April 6th, 2013).

Your using a lowercase t in your date format string.

t   Number of days in the given month   28 through 31 

On Line 92:

echo get_the_time('M-t-y \a\t g:ha' , $id);

I think you meant to use d or j instead.

| improve this answer | |
  • Great catch! That was the issue alright, thanks for noticing that. – Eckstein Apr 7 '13 at 16:21

If this is on a VPS or a dedicated server, I would advise you take a look at your server's settings and adjust the time accordingly.
PHP gets the time from the system so this might be a simple case of misconfigured time on the server side.

| improve this answer | |
  • 3
    Always check the code before suggesting configuration settings. 99% of the time the code is wrong. – Chris_O Apr 7 '13 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.