Sunday, July 22, 2012

Re: Change created/modified to unix time

Where are you doing these searches? If in the database I don't think
there would be much of a performance hit.

The searches are within the database yes, the problem is that "not much of a performance hit" isn't ideal when carrying out a large number of searches.
 

You could do a conversion in AppModel::afterFind and add a new key,
'timestamp' to the data for each record. Or you could even have the
database include it in the results for you, for that matter.

Converting it after performing the search wouldn't help the performance of the search unfortunately.
 

> I realise there may be the excuse that formatting would be required as unix
> timestamps are unreadable, but this is also the case with the current setup
> as how many people use YYYY-MM-DD HH:MM:SS when displaying dates? it's
> usually DD-MM-YYYY or MM-DD-YYYY.

No it's not usually those formats. YYYY-MM-DD is an ISO standard for
good reason. It sorts naturally, for one thing. Another obvious reason
is right there in your comment: "DD-MM-YYYY or MM-DD-YYYY" Yes? Which
is it then? They're ambiguous, so should be avoided.

Sorry by usually I'm referring to US/UK, I have a slight bias :)
 

Now, if only some countries would also adopt the metric system. ;-)

> What does everyone else think?
>
> Is there a way to convert the current created/modified fields to UNIX
> timestamps with current CakePHP?

I'll leave it for someone else to say. I know that I have seen where
that is set but cannot remember now.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate