To correctly format a DateTime object in PHP for storing in MySQL use the standardised format that MySQL uses, which is ISO 8601.. PHP has had this format stored as a constant since version 5.1.1, and I highly recommend using it rather than manually typing the string each time. So the server will provide us the information in the standard format when the date function gets executed.If you want to change the format as you wish it can be done using several ways. date description Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. Date time formatting in PHP Many scripts written in php need date and time function . Convert String to DateTime Javascript… Related. 4173. Month and weekday names and other language-dependent strings respect the current locale set with setlocale() PHP Version: 4+ PHP Changelog: PHP 5.1: Now issues E_STRICT and E_NOTICE time zone errors 2773. 0. PHP has many predefined date formats and you can also customized it as per your need . 0. 0. Php Date Format. This tutorial uses PHP strtotime() and date() functions to convert date time format. PHP Date String Format. PHP has a class DateTime for managing date and time.