sharing!
On Oct 24, 4:12 pm, teknoid <teknoid.cake...@gmail.com> wrote:
> $time->format(); handles all that quite nicely
>
> On Oct 23, 1:10 pm, rgreenphotodesign <rgr...@rgreenphotography.com>
> wrote:
>
> > Forgive me if I've duplicated something that has already been stated
> > in my first post on the group.
>
> > I had a need and design to take a DATE data type and display it with
> > the niceShort helper. It worked with the exception of showing all
> > zeros for the time.
>
> > I added to helper:
>
> > * Returns a nicely formatted date string for given Date string.
> > *
> > * @param string $dateString Date string or Unix timestamp
> > * @param int $userOffset User's offset from GMT (in hours)
> > * @return string Formatted date string
> > */
> > function niceDate($dateString = null, $userOffset = null) {
> > if ($dateString != null) {
> > $date = $this->fromString($dateString, $userOffset);
> > } else {
> > $date = time();
> > }
>
> > $ret = date("D, M jS Y", $date);
> > return $this->output($ret);
> > }
> > /**
>
> > Now 2008-10-31
> > Gets displayed as Fri, Oct 31st 2008
>
> > All that changed from the other functions was the removal of the h:i
> > in the date function. Hope this is useful to someone. Or if there is a
> > better way to do the same thing I'm open to learning!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment