Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
MATHIEU LOISEAU

Date column: unable to use custom format

Hello,

I added to my user table a “last_login” column.

Updated using: update_user_meta($user->ID, 'first_login', \Carbon\Carbon::now()->format('d/m/Y H:i:s'));
Also tried with: update_user_meta($user->ID, 'first_login', \Carbon\Carbon::now()->timestamp);

I then used as date format “d/m/Y H:i:s” and “u”: nothing is displayed in column. I have to remove the “date” format to have the raw text value displayed.

Thanks

1 week, 1 day ago
MATHIEU LOISEAU

Edit: my example use “first_login”, but my tests are with “last_login”, and from database user_meta table, values are OK and match the defined format.

1 week, 1 day ago
Stefan
Developer

So just to be sure.
You’ve used our custom field column with type set to ‘Date’?
When the actual value is of the meta field is a timestamp, I expect the display value should work without any problem. But when your value is stored as ‘d/m/Y H:i:s’ I suspect it will not work as intended.
The best format for in the database in my opinion is a timestamp or ‘Y-m-d H:i:s’ format. Both formats can also be used natively to sort and filter in the database, so not only for Admin Columns but probably other features as well, I recommend to use one of those.

But if the timestamp is not working as expected, I’m curious why it doesn’t work. Can you contact me at support@admincolumns.com and send me a screenshot of your column settings for this specific column you’ve setup?

1 week, 1 day ago

You must be logged in to reply to this topic.