Change to actual date from "x years ago"

I (believe I) have found the code that governs the timestamp in my Wordpress TechDesk theme but don’t know how to change it. I want every post to show the date that I specify as the post date even if it was many years ago (I am posting a lifetime of writing).

The code in Single.php is in the attached screenshot. I know HTML and CSS but I do NOT know anything about PHP or JS, so please spell out exactly what I should do.

Please let me know if you need more screenshots.

Thank you!


Since you only posted an image, I can’t give you the line # you need to change. So, where it has [php]get_the_time(‘U’)[/php]

is WHERE you need to change the value. As far as what to change it to: what format do you want? You can check here for the format to use.

Thank you. I reviewed the time/date formats, and looked up syntax somewhere, and tried this but it didn’t work:

<?php if ( $show_date == 1 ) { echo human_time_diff( get_the_time('M/j/Y'), current_time('timestamp') ) . ' ago'; }

I also tried with deleting …), current_time(‘timestamp’) ) . ’ ago’;
}

since “years ago” is the part I don’t want.

I also tried ‘MjY’ and "M j Y’
:frowning:

So you want just the date to show?

Try this,

[php]echo get_the_time(‘M/j/Y’);
} [/php]

That should just output the converted date, I can’t be certain though.

http://codex.wordpress.org/Function_Reference/get_the_date

YES! Thank you. I fine-tuned the date format to
{
echo get_the_time(‘n/j/Y’);
}
and that is exactly what I want.

I’ve been thinking for a while that the next code I should learn is PHP, not JS. I love code (when it works, lol).

Thanks for your help.

–DD

Sponsor our Newsletter | Privacy Policy | Terms of Service