How to convert a date from MySQL DATETIME format to another format using PHP?
Hello everyone! I'm a beginner in PHP and writing my first website in this language with a MySQL database. I have a `users` table that stores the user's registration date in the standard MySQL DATETIME format: `2023-10-15 14:30:00`. When I output this date on the page via `echo $row['registration_date'];`, it displays in the same ugly format, for example "2023-10-15 14:30:00". But I need the date to show as "15 October 2023, 14:30" or at least "15.10.2023".\n\nI tried using the `date()` function, but it returns the current date, not the one from the database. I attempted to pass the string from the database to `strtotime()`, but I'm not sure if I'm doing it correctly. Here's my current code:\n\n```php\n
No answers yet.
Log in to leave an answer