Add to Favorites
Hosting Discussion
 

Hosting Discussion > Web Hosting Forums > Website Development & Design > Date Format MYSQL / PHP - again!
forgot password?


Reply


Old
  Post #1 (permalink)   10-10-2005, 02:53 PM
HD Newbie
 
Join Date: Oct 2005
Location: Southampton, England
Posts: 2

Status: Nath is offline
I've just read Svetly's entry in the forum and didn't manage to find my answer. I too have a MYSQL database which contains a date field stored in the standard MYSQL YYYY-MM-DD format. I live in England and I would like to display this on my website in the DD-MM-YYYY format. I use the date in drop down list boxes and the code looks like this:

<select name="WeekSelect" class="tableText" id="select2">
<?php
do {
?>
<option value="<?php echo $row_Week['weekID']?>"><?php echo $row_Week['date']?></option>
<?php
} while ($row_Week = mysql_fetch_assoc($Week));
$rows = mysql_num_rows($Week);
if($rows > 0) {
mysql_data_seek($Week, 0);
$row_Week = mysql_fetch_assoc($Week);
}
?>
</select>


Is this enough information to get some help???

Thanks in advance!
__________________
***************
Nath
www.nhillman.co.uk
***************
 
 
 


Old
  Post #2 (permalink)   10-10-2005, 03:39 PM
HD Newbie
 
Join Date: Oct 2005
Location: Southampton, England
Posts: 2

Status: Nath is offline
After posting this I finally figured the solution out. I used the following as my SQL statement and it works perfectly:

SELECT DATE_FORMAT(w.date, GET_FORMAT(DATE,'EUR')) AS date
FROM etc...

This replaced:

SELECT w.date
FROM etc...

I hope this helps others who are looking for similar solutions. The website for the syntax etc. is: http://dev.mysql.com/doc/mysql/en/da...functions.html
__________________
***************
Nath
www.nhillman.co.uk
***************
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On