21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 3724 Views |
-
Current Date into .ss template

8 May 2009 at 12:12am
I want to insert the time and date into the Page.ss template in the following format:
echo date('l jS \of F Y h:i:s A');
-
Re: Current Date into .ss template

8 May 2009 at 12:17am Last edited: 8 May 2009 12:19am
$WhateverYourDateFieldIs.Format(F Y h:i:s A)
EDIT: If you are trying to return the current time and date, the easiest way would probably be to write a function in the controller of page.php
function showTime(){
return date('l jS \of F Y h:i:s A');
}and call $showTime where ever in the template.
-
Re: Current Date into .ss template

8 May 2009 at 8:41pm
You can also use the $Now var in templates (which is a DateObject) to return the current date. See http://doc.silverstripe.com/doku.php?id=date for the range of formatting options with $Now
-
Re: Current Date into .ss template

21 May 2009 at 4:29am
How do you insert a date on a page to show when it was last updated?
-
Re: Current Date into .ss template

22 May 2009 at 2:57pm Last edited: 22 May 2009 2:59pm
$LastEdited
You can also specify the date format, e.g:
$LastEdited.Format(d M Y h:i a)
-
Re: Current Date into .ss template

21 September 2009 at 2:32pm
If you want to use a comma (,) in your date field, see this thread:
| 3724 Views | ||
|
Page:
1
|
Go to Top |





