What is the recommended method for converting SQL Datetime to JSON format for visualization with Highcharts in PHP?

When converting SQL Datetime to JSON format for visualization with Highcharts in PHP, it is recommended to use the strtotime() function to convert the datetime value to a Unix timestamp, which can then be easily formatted into a JSON-friendly format using the date() function. This allows for seamless integration of the datetime data with Highcharts for visualization.

// Assuming $datetime is the SQL datetime value retrieved from the database
$unix_timestamp = strtotime($datetime);
$json_datetime = date('Y-m-d H:i:s', $unix_timestamp);

// Now $json_datetime can be used in the JSON data for Highcharts visualization