Stefanowitsch Posted June 9, 2022 Share Posted June 9, 2022 I am bootstrapping processwire in a php file for cronjob purposes. Everything works fine, I can output all the data from fields that I like. What confuses me: I have a datetime field. When displaying the field value in the bootstrapped file, I only get the timestamp of the selected date. When displaying the same field value on a page inside of processwire the field value is a formatted date. Can somebody explain to me why this is the case and to get around this (without date formatting). Link to comment Share on other sites More sharing options...
AndZyk Posted June 9, 2022 Share Posted June 9, 2022 Hello @Stefanowitsch, you get the unformatted value of the datetime field probably because output formatting is turned off when bootstraping ProcessWire. You could try to temporarily turn it on and then turn it off again: $page->of(true); // Turn output formatting on echo $page->date; // Should be formatted $page->of(false); // Turn output formatting off again But I would rather just format the date. ? Regards, Andreas Link to comment Share on other sites More sharing options...
Stefanowitsch Posted June 9, 2022 Author Share Posted June 9, 2022 5 minutes ago, AndZyk said: Hello @Stefanowitsch, you get the unformatted value of the datetime field probably because output formatting is turned off when bootstraping ProcessWire. You could try to temporarily turn it on and then turn it off again: $page->of(true); // Turn output formatting on echo $page->date; // Should be formatted $page->of(false); // Turn output formatting off again But I would rather just format the date. ? Regards, Andreas Thanks! But this does not work unfortunately... However formatting the date like this was the workaround for me: date("d.m.Y", $termin->startdatum) 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