Table: News Field: datestamp Field Type: date
<?php foreach($news as $row): ?> <h3 class="h3_2"><?php echo $row->datestamp ?></h3>
I would like to format as "11/22/2009". What is the best way to accomplish this?
I can use
<?php echo Yii::app()->dateFormatter->formatDateTime($row->datestamp, 'long', '') ?>
but the format is not quite what I want and seems quite long to put in the view.
I tried to use CDateFormatter::format(‘mm/dd/yyyy’, $row->datestamp) but get a different error.
1. Should I or can I do this at the "News" activerecord model level?
2. Why is there not an easier formatting function since this is a common need?