![]() |
Change date format - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Change date format (/showthread.php?tid=75684) |
Change date format - kanhaiyaa - 03-05-2020 Hey there I'm new to this community. While registering events etc. the date format is yyyy/mm/dd but I want to change this format to dd/mm/yyyy however I am not getting this output, anyone please could min help? sry for my bad english. hindi RE: Change date format - InsiteFX - 03-05-2020 How do I Convert Date Format in PHP RE: Change date format - vincent78 - 03-05-2020 I've created a bunch of DateTime classes: https://github.com/vmoulin78/concorde/tree/master/system/utils/datetime and to use it: PHP Code: $dt = new Mysql_datetime('2020-03-24'); or: PHP Code: $dt = new Mysql_datetime(); //equivalent to $dt = new Mysql_datetime('now'); RE: Change date format - zahhar - 03-06-2020 Well, you could benefit from built-in Time class in CI4 internalization library rather then invent the week and bring in yet another custom converter: PHP Code: use CodeIgniter\I18n\Time; Now you can adjust input format in creareFromFormat() first parameter to match your source, and adjust output format in toLocalizedString() parameter to receive desired format with respect to localization settings of your application or even your current user. |