Hi..
I got a problem with the date and time in php..
This is the story.
1)I want to get the date and time automatically whenever a person write onto the field that i have made(eg. the blogpost field).
2)Then,after i stored it into the database, i want to output it into my desired format.That is like this :
September 8 2010 at 11:46am
And what i have done was created a field of dateandtime and made its stored data as the timestamp type in my phpmyadmin.
BELOW IS THE WORKS :
This is the part where someone entering something into the field :
..some codes here...
<textarea rows="18" id="postcontent" name="blogpost" cols="100"></textarea>
...some codes here...
and after clicked submit,this page will be redirected to the other page:
This is the page and my query to insert the date and time :
<?php
$blogpost=$_POST['blogpost'];
$query = "INSERT INTO blogpost,dateandtime (blogpost,dateandtime) VALUES ( '{blogpost}',NOW() ) ";
?>
This is how I echoing the date on the mainpage :
$result = mysql_query("SELECT * FROM dateandtime");
while($row=mysql_fetch_array($result))
{
echo "$row["blogpost"]".$row["dateandtime"];
}
Thus,by using the timestamp,how could i do that format that i want?Or there is the other way that i could use to get the date automatically and format it into that way?
Please help.Thank You :)