How to separate date in php
Posted
by user225269
on Stack Overflow
See other posts from Stack Overflow
or by user225269
Published on 2010-05-04T13:09:00Z
Indexed on
2010/05/04
13:18 UTC
Read the original article
Hit count: 136
I want to be able to separate the birthday from the mysql data into day, year and month. Using the 3 textbox in html. How do I separate it? I'm trying to think of what can I do with the code below to show the result that I want:
Here's the html form with the php code:
$idnum = mysql_real_escape_string($_POST['idnum']);
mysql_select_db("school", $con);
$result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'");
$month = mysql_real_escape_string($_POST['mm']);
?>
<?php while ( $row = mysql_fetch_array($result) ) { ?>
<tr>
<td width="30" height="35"><font size="2">Month:</td>
<td width="30"><input name="mo" type="text" id="mo" onkeypress="return handleEnter(this, event)" value="<?php echo $month = explode("-",$row['BIRTHDAY']);?>">
As you can see the column is the mysql database is called BIRTHDAY. With this format:
YYYY-MM-DD
How do I do it. So that the data from the single column will be divided into three parts? Please help thanks,
© Stack Overflow or respective owner