datetime Formatinng on ouput

Hey there,

I’m wondering how you can format a datetime column value into say “Jan, 5th 2011 - 5:30pm” or something. My app uses the datetime column throughout but I haven’t figured out a way to pretty up the timestamp on output?

This would be for MySQL, btw.

Thanks in advance. Let me know if you guys have any special routines or ways of doing this. I may just be missing something. What I’ve found is more about what I already have done - which is making sure the fields are automatically updated on beforeSave, etc.

J

Actually never mind, found a solution it appears:

<?php echo Yii::app()->dateFormatter->formatDateTime($data->created, ‘medium’) ?>

If anyone is looking for the same thing, this seems to be working just fine. I’ll have to dig into formatDateTime method and see if you can actually set the output yourself like PHP’s date function accepts (m-d-Y h:i:s), etc.