formfields.com Forum Index formfields.com
FORMfields Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How Do I Format a Date?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> TH 2.0 - Frequently Asked Questions (FAQs)
View previous topic :: View next topic  
Author Message
formfields



Joined: 01 Aug 2005
Posts: 465

PostPosted: Wed Dec 14, 2005 4:59 pm    Post subject: How Do I Format a Date? Reply with quote

Here is an example of how to format a date so that it displays in standard USA form. This example works with the data described on http://www.formfields.com/tableHelpersArea/tutorial2.php.
Code:

   $table = new TableSet();
   $table->enableSort = true;
   $table->loadQuery(
      "SELECT advertiser AS 'Advertiser',"
         . "clicks AS 'Clicks',"
         . "impressions AS 'Impressions',"
         . "DATE_FORMAT(date,'%c/%e/%Y') AS 'Day' "
      . "FROM traffic"
   );
   echo $table->getTableTag();

For information on date formatting, please see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> TH 2.0 - Frequently Asked Questions (FAQs) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group