View Single Post
Old 11-02-2004, 05:34 AM   #4 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
You may need to surround the action/method in quotes.

Code:
<form action="search_news.php" method="POST">
Quote:
in my database i have a field with datetime type how to print just the time or just the date from that type
I can't remember how the datetime type is formatted, but you're either going to have to use internal mysql functions (if there are any) or use PHP string functions to extract the portion of the datetime then display as needed.

http://dev.mysql.com/doc/mysql/en/DATETIME.html

So if the format is YYYYMMDDHHMMSS:
PHP Code:
$dt substr($row_result["datetime_fieldname"], 08);
// now $dt is "YYYYMMDD"
$tm substr($row_result["datetime_fieldname"], 8);
// $tm is HHMMSS 
idx is offline   Reply With Quote