Hi,
I've successfully enabled a filter (https://toolset.com/forums/topic/archive-query-filter-based-on-cred-field/) based on the _cred_post_expiration_time for a user who is posting to a directory site. Each entry is called a "Listing."
In the user's account page, I'm creating a View to show all of their existing, active listings + all of their expired listings. I can successfully do that using a Query Filter, as the link shows above.
What I would like to do for the existing, active listings is to show both the Post Date ("This listing was created on May 3, 2021") and the Expiration Date ("This listing will expire on June 31, 2021.") I easily got the post date and I was able to call the _cred_post_expiration_time to the View, but it's formatted in a very strange set-up. It currently just outputs a string of numbers.
I presume this has to do with system defaults somewhere? Probably like
or something like that? How can I change this to output a user-friendly date? Do I need to create a custom function to hook to this post-field?
The shortcode that is created inside the View, for the record, is
[wpv-post-field name='_cred_post_expiration_time']
.
Thank you!
Hello and thank you for contacting the Toolset support.
Toolset stores datetimes as timestamps, the number of seconds from the UNIX epoch, that's why you get a string of numbers.
hidden link
Instead of using the wpv-post-field shortcode that will display the raw value of a customfield(unless it was defined in Toolset->Custom Fields), use the cred_post_expiration shortcode that accepts a format argument
[cred-post-expiration format="m/d/Y"]
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_post_expiration
I hope this helps. Let me know if you have any questions.