What are the potential pitfalls of storing dates as TEXT in a PHP database?

Storing dates as TEXT in a PHP database can lead to inefficient sorting and querying of date values, as they are not stored in a date-specific format. To solve this issue, it is recommended to store dates in a proper date format (such as DATETIME or TIMESTAMP) to ensure accurate date manipulation and querying.

// Example of storing dates in a proper date format (DATETIME)
$date = date('Y-m-d H:i:s');
$query = "INSERT INTO table_name (date_column) VALUES ('$date')";
mysqli_query($connection, $query);