Jump to:

3430 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » issue with date.php

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

Page: 1
Go to End
Author Topic: 1058 Views
  • J2-Paul
    Avatar
    Community Member
    51 Posts

    issue with date.php Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: issue with date.php Link to this post

    $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.

  • J2-Paul
    Avatar
    Community Member
    51 Posts

    Re: issue with date.php Link to this post

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

    1058 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.