I am trying to create a function that would return the DAY a post was created. Also, I would like a similar function that would return the Month a post was created. I am using www.anchorcms.com, if that makes a difference. In the docs, they include a function that returns a UNIX timestamp. Look: article_time() Returns a UNIX timestamp from when the post was added, which can be used to add custom timestamps. If you want to use the default timestamp, use article_date() instead.
It's mysql. by the way, will this do what i want? function article_day() { if($created = Registry:: prop('article', 'created')) { return Date::format($created, 'd'); } }
yes, that should work. But note, this is really an anchor-cms question. Each CMS could do things differently. The answer is likely specific to the implementation of anchor-cms. It is using the Registry framework, and describes pages as "article"s. As soon as you showed that, i'm fairly confident your code should work.