Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 1 year ago.
0

Hi Aj,

Please look at the documentation carefully, they actually have example in the doc using what you're after. Also, i am sorry to say this but, the code above you're trying is syntactically incorrect, please refer to PHP OOP Documentation to brush your PHP OO skills.

**here is what you're trying to accomplish **

Date::createFromDate($article->date)->format('l j F Y H:i:s')

Thanks.

Last updated 8 years ago.
0

Thanks a lot this works. When I translate this is this correct?

Date:: - class createFromDate - object $article->date - property format() - method

Sorry for the newbie questions... im still figuring out OOP.

0

Hi Aj,

You're most welcome, and there is no problem at all in asking newbie question, we are all been there at one point, and i can tell you from experience the best thing to do when learning this stuff is to get down in the code and make mistakes and to not be afraid to seek help (ask question).

Mostly correct but createFromDate()* is a method not an object. Here are part of the code.

Date is the class

createFromDate() is a method of a Date class

$article is an object you're passing to createFromDate() method

date is a property of $article object

format() is a method of Date class

I hope this is what you've asked and it's a helpful to you.

Thanks.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ajdemoed ajdemoed Joined 10 Dec 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.