Susan; ;
Thanks for putting me on the right track with that little php snip.
I needed a way to parse out the date to put into a blog entry date box.
What I did is take your php code and turn it into 3 handy snippets;
getDay
getDay
<?php
$time = time();
$day = date('d',$time);
echo $day;
?>
getMonth
getMonth
<?php
$time = time();
$month = date('m',$time);
echo $month;
?>
getYear
getYear
<?php
$time = time();
$year = date('Y',$time);
echo $year;
?>
I needed a text abbreviation of the month so I made another snippet to turn the number into text
abvTextMonth
<?php
$time = time();
$curMonth = date('m',$time);
switch($curMonth){
case 01:
$output='Jan';
break;
case 02:
$output='Feb';
break;
case 03:
$output='Mar';
break;
case 04:
$output='Apr';
break;
case 05 :
$output='May';
break;
case 06:
$output='Jun';
break;
case 07:
$output='Jul';
break;
case 08:
$output='Aug';
break;
case 09:
$output='Sep';
break;
case 10 :
$output='Oct';
break;
case 11 :
$output='Nov';
break;
case 12 :
$output='Dec';
break;
}
return $output;
?>
works like a charm in my blog template - see the image below.
code fragment from my blog summary template using the above code to put the date in a box.
<div class='date'>[!abvTextMonth!]<span>[!getDay!]</span>[!getYear!]</div>
Thanks for your help.
Hal