close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date Format

Thread began 11/17/2010 3:39 am by PRIME | Last modified 1/06/2014 5:32 pm by Christopher West | 1938 views | 5 replies |

PRIME

Date Format

My resultspage from dataAssist display date in this format YYYY-MM-DD but I require it as DD-MM-YYYY. I can understand that MySql date format is YYYY-MM-DD but is there any way to change in DataAssist.

Sign in to reply to this post

Dave BuchholzBeta Tester

The simplest way would be to use a custom function:

Paste this code at the top (or bottom of your page)

php:
<?php

/*
Format MySQL Date Field to DD-MM-YYYY
---------------------------------------------------------- 
*/

function i8_formatMySQLDate($date) {
$d str_replace(" ","",$date);
$d explode('-'$date);
$d $d[2].'-'.$d[1].'-'.$d[0];
return 
$d;
}
?>



You would then call the function like so:

php:
<?php echo i8_formatMySQLDate($row_RecordSetName['datefield']); ?>
Sign in to reply to this post

PatriceWebAssist

I am trying to do this also. I have it set up as 2014-02-01 and then next to that, attempting to make it show 01-02-2014.

I pasted the php at top of page, and then where I want the date to appear I have this on the page, where the first line is the default and the second line is my attempt.

Exp:&nbsp; <?php echo $row_consumersoffer['cat_coupon_expdate']; ?>
<?php echo i8_formatMySQLDate($row_consumeroffer['cat_coupon_expdate']); ?>



This admin field for the date is managed in DataAssist using the calendar function for the client to use. In the admin, it shows the date as 2/01/2014 but on the display page, using bindings to pull the date into the page, it reverts.

Any guidance most appreciated.

Sign in to reply to this post

PatriceWebAssist

Found a solution in another thread

<?php echo date("m/d/Y", strtotime($row_consumersoffer['cat_coupon_expdate'])); ?>

http://www.webassist.com/forums/posts.php?id=2877

:-)

Sign in to reply to this post

Jason ByrnesWebAssist

Glad to hear you found the solution.

Sign in to reply to this post

Christopher WestCommunity Expert

Originally Said By: Patrice
  Found a solution in another thread

<?php echo date("m/d/Y", strtotime($row_consumersoffer['cat_coupon_expdate'])); ?>

http://www.webassist.com/forums/posts.php?id=2877

:-)  



Some time ago I did put up a tutorial for date formatting (examples using both server date as well as date stored in a database...here was the original tutorial: http://www.webassist.com/forums/posts.php?id=17179

Then if you use the documentation from the official php website: http://www.php.net/manual/en/function.date.php

you can adjust the format to anything you like :)

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...