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 change the timestamp format of my view form script?

 
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 -> FG 2.0 - Frequently Asked Questions (FAQs)
View previous topic :: View next topic  
Author Message
omegared
Guest





PostPosted: Tue Oct 18, 2005 12:47 am    Post subject: How do I change the timestamp format of my view form script? Reply with quote

How do I change the timestamp format of my view form script?
Back to top
formfields



Joined: 01 Aug 2005
Posts: 465

PostPosted: Tue Oct 18, 2005 12:54 am    Post subject: Reply with quote

If you are using a more recent version of MySQL then your timestamp should already be in the form: yyyy-mm-dd hh:mm. However, if you are using an older version of MySQL then you can do the following to modify how your timestamp is displayed:

1. Modify the loadQuery string so that it uses DATE_FORMAT to format the timestamp:
Code:

 $tableSet->loadQuery("SELECT CONCAT('<a href=\"?__id=',__id,'\">View</a>') AS ' ', __id AS 'ID', name AS 'Full Name',email AS 'Email',addr1 AS 'Address Line 1', DATE_FORMAT(__timestamp, '%Y-%m-%d %h:%i %p')  AS 'Timestamp' FROM coldcreekbankmortgageapplication");


2. Format the value of __timestamp:
After the call to $formBean->loadValues(), add:

Code:
      
$ts = $formBean->getValue("__timestamp");
$dateStr = substr($ts, 0, 8) . " " . substr($ts, 8, 2) . ":" . substr($ts, 10, 2);
$formBean->setValue("__timestamp", date("Y-m-d h:i A", strtotime($dateStr)));
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 -> FG 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