I am using hook_entity_presave to combine the values from a date field and a text field in another field. To do so, I need to format the date first. I would like to use one of the date formats defined in admin/config/regional/date-time for this. How do I do this? Here is how I get the date field value, which outputs the date format as YYYY-MM-DD:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.