regesh Posted February 2, 2022 Share Posted February 2, 2022 How to make a hook that will customize value of field and output function result. I want for field date (in templates) to display values like: yearstaday or today or in other ways 21 may(in my lang) 2021. So for that i got function to parse Y-m-d to what i need. But i do not how to create hook. Thanks a lot! Link to comment Share on other sites More sharing options...
BillH Posted February 2, 2022 Share Posted February 2, 2022 If you want dates to output in other languages, I'd start here: And perhaps also look at this: If you want all dates from a particular field to be formatted the same on output, look at the Details tab for the data field. To format dates on a template, use PW's $datetime->date() (see https://processwire.com/api/ref/wire-date-time/date/). Or you could get the timestamp (the unformatted date) with $page->getUnformatted("date_field") and then use PHP's date functions – particularly strftime(). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now