Re: Date Format output

2006-08-23 Thread c_doug

Can the time helper apply a mask in the view (for example MM/DD/)?

If not, is the best way to do it to modify the time helper itself in
the helpers directory?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Re: Date Format output

2006-08-23 Thread Samuel DeVore

make a new helper for yourself that uses the above  (in hindsight I
should of called mine dateWithMask )

in the definition of the helper use $helper = array('Time); then you
can use the existing time helper

I would strongly recommend against changing the existing time helper!



On 8/23/06, c_doug [EMAIL PROTECTED] wrote:

 Can the time helper apply a mask in the view (for example MM/DD/)?

 If not, is the best way to do it to modify the time helper itself in
 the helpers directory?


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Date Format output

2006-08-23 Thread c_doug

Right, that's what I was sort of thinking. I think getting more into
helpers is going to interesting. Thanks, again.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Date Format output

2006-08-23 Thread Samuel DeVore
here is my general rule of thumb, if I do something more then twice in views, rather then do it a third time I add it to one of my common helpers, if there is something close already in an existing helper, I try to leverage that work. Every once in a while I revisit and try to refactor my helpers. I have a set of helpers that I share among many projects (they are external checkout of my svn so they are all kept in sync, then there are project specific helpers which I do not keep synced. (I have the same thing for components, and am sure that when 
1.2 roles around I'll have them for behaviors)Sam DOn 8/23/06, c_doug [EMAIL PROTECTED]
 wrote:Right, that's what I was sort of thinking. I think getting more into
helpers is going to interesting. Thanks, again.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake PHP group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Date Format output

2006-08-23 Thread c_doug

Thanks for the added advice. That worked really well. I made a new
slightly modified function in the time helper and used:

echo $html-link($time-niceMonth($a['Post']['created']), /posts/)?

So simple once you get the basic idea.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Date Format output

2006-08-21 Thread Samuel DeVore

have you looked at the php date function?  http://php.net/date  or you
can do what I did and make a custom helper function that allows one to
custom format dates.  like

function niceShort($date_string, $format='l j F Y', $return = false)  {
$timestamp = $this-Time-toUnix($date_string);
return($this-output(date($format,$timestamp),$return));
//code here
} // END function

this is 'my' version of the niceShort helper that is in the Time
helper  (notice I use some functions from that helper.  I found that I
was doing this enough that I extended the function for my own use.

 This should give you a starting point ;)

Sam D  (the resident old fart)


On 8/21/06, c_doug [EMAIL PROTECTED] wrote:

 Can someone give me an idea of how to output a date in a certain
 format? In this case I am trying to only output the month in the view.

 Can I add a simple function to:

 $a['Post']['created']

 to make it output just a month or various date formats?

 I have searched but haven't been able to apply what I have found.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Date Format output

2006-08-21 Thread c_doug

Thanks, I'll have to try that once I get a little more advanced.

I am trying to apply different variations of PHP date functions to it.

I am hoping to put a simple function around the 'created' variable
above. Something like:
date('mask', created).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Re: Date Format output

2006-08-21 Thread Samuel DeVore

you need to convert the date string to a unix timestamp before you can
use it in date()  you can use the Time helper function toUnix to
accomplish this or look at
http://us3.php.net/manual/en/function.strtotime.php for the string to
time function.

the unix timestamp is probably your sticker on this

date('mask' $this-Time-toUnix($a['Post']['created']))

should get you closer  (it's all the helper function is doing)

On 8/21/06, c_doug [EMAIL PROTECTED] wrote:

 Thanks, I'll have to try that once I get a little more advanced.

 I am trying to apply different variations of PHP date functions to it.

 I am hoping to put a simple function around the 'created' variable
 above. Something like:
 date('mask', created).


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Date Format output

2006-08-21 Thread Mikee Freedom

don't forget the Time helper

http://manual.cakephp.org/chapter/helpers
http://api.cakephp.org/class_time_helper.html

On 22/08/06, c_doug [EMAIL PROTECTED] wrote:

 Thanks, I'll have to try that once I get a little more advanced.

 I am trying to apply different variations of PHP date functions to it.

 I am hoping to put a simple function around the 'created' variable
 above. Something like:
 date('mask', created).


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---