English 中文(简体)
日期:format() vs PHPdate()
原标题:SQL date_format() vs PHP date()

在座标上,我可以采用以下方式来安排时间:

SELECT article_name, DATE_FORMAT( article_date,  %b %e, %Y  ) AS my_date FROM tblArticles

公共卫生和社会福利部也可使用:

echo date( M j, Y , strtotime($row[ article_date ]));

我的网页上有大约50+件。 因此,在PHP I中,记录、格式和印刷。 如果我使用<代码>_format(<>/code>,可在查询本身内避免通过购买力平价进行的格式编排。

So, among these two approaches, which one would you prefer(regarding performance) ? My pages are likely to get several hit and this app would be hosted in a shared hosting. So, I am concerned with performance at the moment. I just don t want to give more load to my server. :)

提前感谢。

最佳回答

但是,你应该把《守则》描绘成准确的情况。 或许还有更好的条件,使你能够优化,因为这一 is可能成为你的系统的一个业绩瓶颈。 确定如何最优化关注的最佳途径是了解你的守则。 否则,你就冒着优化不真正发挥作用的东西的风险。

问题回答

There is nothing related to the performance in your question actually.

Please don t ask performance related questions just out of nowhere. Try to find whatever reason for them. Otherwise you may occupy yourself for years, with "important" questions like "what function to use?" "in what order to write operators" etc.

There is no difference in terms of performance. Such a silly data transformations will never affect it.
Large data processing should be your concern, not simple formatting functions.





相关问题
Mysql compaire two dates from datetime?

I was try to measure what is faster and what should be the best way to compare two dates, from datetime record in MySql db. There are several approaches how to grab a date from date time, but I was ...

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date ...

Convert date Python

I have MMDDYY dates, i.e. today is 111609 How do I convert this to 11/16/2009, in Python?

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

NSDateFormat, super simple! Where am I screwing up?

Ok, this is really simple, maybe I m a getting a bit burnt out, but seems like it should work, Query XML feed, put out date string, format, display in a cell. The issue is I m a getting a NULL ...

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export ...

热门标签