Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7868761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:06:13+00:00 2026-06-03T01:06:13+00:00

In SQL, I can format the date field using the following: SELECT article_name, DATE_FORMAT(

  • 0

In SQL, I can format the date field using the following:

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

The same thing can be done in PHP using:

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

And in my page, there would be around 50+ items. So, in PHP I would loop through the records, format the date and print them. The formatting done via PHP could be avoided if I use the date_format() within the query itself.

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. 🙂

Thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:06:15+00:00Added an answer on June 3, 2026 at 1:06 am

    Doing everything in SQL will probably be faster than doing in PHP, however you should profile the code to figure out the exact situation. There are also probably better places for you to optimize since this isn’t likely to be a performance bottleneck in your system. The best way to determine where to focus your optimizing attention is to profile your code. Otherwise, you risk optimizing things that don’t really make a difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to extract a date field from a mysql db using .NET and
I am using a datetimepicker from jQuery, and when I select a date from
How can I format a date in Visual Basic to be in sql 121
I have the following SQL statement: SELECT 420, DueDate, ISNULL(Amount, 0) FROM Payments WHERE
I have a row from an SQL table, and one field is a DATE.
I can change SQL at runtime. Can I do the same with LINQ ?
In SQL server I can say: Select top 50 percent How can I say
I have a String to Date conversion problem using SQL Bulkcopy in asp.net 3.5
How can I format the Null Dates in my Oracle SQL to 00/00/0000. I
I get the lastupdated date from SQL Server 2008 which has the follow value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.