0

$user->user_registered displays "Registered since: 2014-08-18 07:25:22"

I just want to show the date, not the hour. How can I hide the hour and just show the date?

thank you

2 Answers 2

2

You could just show the first 10 characters of the string, like:

echo substr($user->user_registered, 0, 10);
0
1

Consider using DateTime as this would give the ability to format the date:

$user = wp_get_current_user();
$date = new DateTime($user->user_registered);
echo 'Registered since: '.$date->format('jS F Y');

Your Answer

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

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