'Date_Format only returns first value

Trying to convert my variable edate to long hand using date_format.

This: $query = "SELECT DATE_FORMAT(events.edate, '%W %D %M %Y')"; produces Tuesday

This: $query = "SELECT DATE_FORMAT(events.edate, '%W%D%M%Y')"; produces Tuesday29thMarch2022

This: $query = "SELECT DATE_FORMAT(events.edate, '%W-%D-%M-%Y')"; produces Tuesday-29th-March-2022

I want the second version with spaces. Any suggestions please?



Solution 1:[1]

Many thanks for your help. After further trial and error I have discovered my error. I was passing the result in an url without using urlencode. I have now added that and it works perfectly.

Thanks for all your responses.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrew Helme