Problem:
A user asked about the best approach for sharing date information without a specific day.
Solution:
Guided that it is possible to show the date type field's output in any date/time format, using the "format" attribute.
However, storing the month and year without the actual day is challenging as the Toolset's date type field stores the selected date in a UNIX timestamp format ( ref: https://en.wikipedia.org/wiki/Unix_time ).
This format stores the exact date and time reference, in which the day component can't be skipped.
For this reason, if you just need to store and display month and year with the posts and don't plan to perform any date based search/filtering on these, it would be better to replace a single date type custom field, with two select type custom fields, one for the month and the other for the year.
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 2 years, 9 months ago.
Assisted by: Waqar.