mastubbs Posted July 25, 2013 Share Posted July 25, 2013 Hi all, So i am passing a data from a form, in the format yyyy-mm-dd. I want to convert that to dd/mm/yyyy but for some reason i cant get it to work. Can anybody tell me what im doing wrong? $date = $_GET['date']; $date_uk = $date->format('d/m/Y'); Error is: Fatal error: Call to a member function format() on a non-object Thanks in advance for any help, Matt Link to comment https://forums.phpfreaks.com/topic/280491-change-date-format/ Share on other sites More sharing options...
PravinS Posted July 25, 2013 Share Posted July 25, 2013 $date is variable and you are using is as object $date->format('d/m/Y'), so you are getting this error Link to comment https://forums.phpfreaks.com/topic/280491-change-date-format/#findComment-1442071 Share on other sites More sharing options...
Muddy_Funster Posted July 25, 2013 Share Posted July 25, 2013 $date is your variable - it's the string value of the date passed through the $_GET superglobal, it is not an object. What you are trying to do, and how to do it, is coverd in the manual pages here Link to comment https://forums.phpfreaks.com/topic/280491-change-date-format/#findComment-1442072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.