Custom Search

News World

Jun 6, 2011

PHP > Using DATE_FORMAT

1 #########################################
2 SIMPLE SCRIPT FOR DATE FORMAT
3 #########################################
4
5 < ? php
6 mysql_connect('localhost');
7 mysql_select_db('foo');
8 $result = mysql_query(
9 "select id, email,
10 date_format(ts,'%W %M %D, %Y %r') as d
11 from users order by ts");
12 if($result) {
13 while($row = mysql_fetch_assoc($result)) {
14 echo "$row[id] - $row[email] - $row[d]
\n";
15 }
16 } else {
17 echo mysql_error();
18 }
19 ? >

Output:
mesakh - web.solusi@gmail.com - Tuesday June 5th, 2011 09:26:46 AM
abetnego - e_webmedia@yahoo.com - Tuesday June 5th, 2011 09:26:46 AM

No comments:

IT Conversations

Moneycontrol Latest News

Latest new pages on Computer Hope

Latest from Infoworld

Door Lock

Door Lock Import Top Door Lock from China Contact Quality Manufacturers Now