formfields
Joined: 01 Aug 2005 Posts: 465
|
Posted: Tue Oct 18, 2005 12:54 am Post subject: |
|
|
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)));
|
|
|