Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

issue with date.php


Go to End


3 Posts   1678 Views

Avatar
J2-Paul

Community Member, 51 Posts

23 May 2010 at 6:42am

The Day() method is not working for me.

I am working with Tutorial 2. This code below from my template

Posted on Long: $Date.Long by $Author<br>
Posted on ShortMonth: $Date.ShortMonth by $Author<br>
Posted on URLDate: $Date.URLDate by $Author<br>
Posted on Year: $Date.Year by $Author<br>
Posted on Month: $Date.Month by $Author<br>
Posted on Day: $Date.Day by $Author<br>
Posted on Nice: $Date.Nice by $Author<br>

Outputs

Posted on Long: 1 January 2010 by Paul West
Posted on ShortMonth: Jan by Paul West
Posted on URLDate: 2010-01-01 by Paul West
Posted on Year: 2010 by Paul West
Posted on Month: by Paul West
Posted on Day: Friday by Paul West
Posted on Nice: 01/01/2010 by Paul West

Note the Month: >>>> there is not month!

Avatar
Willr

Forum Moderator, 5523 Posts

23 May 2010 at 2:29pm

Edited: 23/05/2010 2:30pm

$Date.Month was not part of the date API till last week (will be part of 2.4.1). For older versions you either use $Date.ShortMonth or use $Date.Format(F) to get the full month.

Avatar
J2-Paul

Community Member, 51 Posts

25 May 2010 at 12:30am

Thanks Will. I guess I should have figured this out myself. New to SS, and development on this level, so please bear with me!