Date convert from SQL |
[eluser]Chilion[/eluser]
Hi! I have a date from a sql DATE field. Then I want to turn that into my preffered format. I use the mdate function now in this way: Code: <?php Then I get an error: Quote:Fatal error: Call to undefined function mdate() in C:\USBWebserver\root\Dweper\frameworkSysteemCodeSecure\core\Loader.php(829) : eval()'d code on line 24 $statistic->creationDate is filled as: 2012-01-04 Hope u can help!
[eluser]PhilTem[/eluser]
There's no native PHP mdate function but it's a CI helper function. So you should ensure, that you loaded the date-helper prior to calling the method. Secondly, I think you're not using the write markup. From the user's guide Quote: In this case, $time is something like 123456789. And that's not matching your format
[eluser]Unknown[/eluser]
You can use native PHP code Code: <?php http://php.net/manual/en/function.date.php
[eluser]Ajaxboy[/eluser]
Code: <?php
[eluser]CroNiX[/eluser]
I prefer to do the date conversion in the actual query using DATE_FORMAT() so it returns the format I want from the getgo. http://www.w3schools.com/sql/func_date_format.asp |
Welcome Guest, Not a member yet? Register Sign In |