?
Solved

SUPER EASY php mysql date display

Posted on 2008-06-10
4
Medium Priority
?
249 Views
Last Modified: 2008-06-10
how do you take a date variable from a mysql database and display it in the date format you choose?
ie.
$db_date=mysql_result($result,$i,"db_date");
$formated_date=$db_date(M,d,Y);
0
Comment
Question by:newbe101
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 21752424
use strtotime and date

$formated_date = date('M,d,Y', strtotime(mysql_result($result,$i,"db_date")));

See http://www.php.net/date and http://www.php.net/strtotime

how does the date from the db look?
0
 
LVL 14

Expert Comment

by:Ali Kayahan
ID: 21752429
$date = date("M,d,Y",$db_date) ;
0
 
LVL 14

Expert Comment

by:Ali Kayahan
ID: 21752432
It will work if you populate your field with time()
0
 

Author Comment

by:newbe101
ID: 21752497
Thank you again, hernst42 !
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The viewer will learn how to dynamically set the form action using jQuery.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question