close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Changing the date format of a field in a results page

Thread began 8/28/2010 9:44 am by iainmacdonald331081 | Last modified 8/29/2010 12:12 am by John Langer | 1418 views | 3 replies |

iainmacdonald331081

Changing the date format of a field in a results page

This must be possible - I'm just trying to change the date format on a page here to the format 28th August 2010, but not sure how to go about it.

educational-tours.php

I've done it OK on the details page :

tourdetails.php?packageID=155

Using

php:
<?php

$colname_DateFormat 
"1";
if (isset(
$_GET['packageID'])) {
  
$colname_DateFormat = (get_magic_quotes_gpc()) ? $_GET['packageID'] : addslashes($_GET['packageID']);
}
mysql_select_db($database_connPackages$connPackages);
$query_DateFormat sprintf("SELECT date_format(dateadded, '%%D %%b %%Y') as formatted_date FROM packages WHERE packageID = %s"$colname_DateFormat);
$DateFormat mysql_query($query_DateFormat$connPackages) or die(mysql_error());
$row_DateFormat mysql_fetch_assoc($DateFormat);
$totalRows_DateFormat mysql_num_rows($DateFormat);
?>



Any pointers on how to do the same on the results page would be much appreciated.

Sign in to reply to this post

John LangerBeta Tester

Where you want to display the date just use this code changing your recordset name as appropriate

php:
<?php echo date('j F Y',strtotime($row_YOUR_RECORDSET_NAME['your_date_field'])); ?>
Sign in to reply to this post

iainmacdonald331081

Thanks John - I now have no idea why, when I looked at how to do this a good while ago, I found the convoluted method used above in the details page.

I'm sure at the time, it looked like one of those little things which had far more complicated a solution than ever seemed reasonable.

So I really appreciate finally discovering that there is, after all, a straightforward way of doing this!

Sign in to reply to this post

John LangerBeta Tester

No problem Iain, glad it worked <phew> :)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...