Rommeo Posted February 23, 2008 Share Posted February 23, 2008 hi i m new at php-programming. i have a problem about getting time from mysql, as you know DATETIME function stores the data like : 2001-12-27 13:30:00 But i want to use it like 27.17.2001 Here s the code i m using <?php include 'db.php'; $sql = "SELECT * FROM tablepeople"; $results = mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql); $num=mysql_numrows($result); $i=0; while ($i < $num) { $nickname=mysql_result($result,$i,"nickname"); $birthdate=mysql_result($result,$i,"birthdatetime"); echo "<b>$nickname 's birthdate is $birthdate</b>"; $i++; } As you know this code is not working cause i have just noticed that i should convert datetime into the format i m using, i have searched for it but could not find any information as much as i need. i just want to print it like : Dido's birthdate is 27.12.1974 John's birthdate is 04.06.1970..etc. i ll be glad if you can help, waiting for this part to finish for to pass next step. Thanx in advance. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 23, 2008 Share Posted February 23, 2008 Use the mysql DATE_FORMAT() function in your SELECT query to output the date in any format you want - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Quote Link to comment Share on other sites More sharing options...
Rommeo Posted February 23, 2008 Author Share Posted February 23, 2008 Thanx for the reply but are you sure that the link is correct ? Cause i could not enter, also my friends could not enter. will be glad if you tell me what to do. Quote Link to comment Share on other sites More sharing options...
jandrews3 Posted February 24, 2008 Share Posted February 24, 2008 The link worked for me. Quote Link to comment Share on other sites More sharing options...
Rommeo Posted February 24, 2008 Author Share Posted February 24, 2008 Thanx jandrews3 so you can read it. That would be very nice if you told me what to do after reading the link.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.