i have a script that query the database for some information which include date field.
my problem is i want the query to just show the date and the time not included.. here is the script that i am using.. btw.. i am using an ms access database for this project..

$conn = odbc_connect('eLibrary','',''); 
    if (!$conn) 
    {exit("Connection Failed: " . $conn);} 

$sql="SELECT Trainings.Date, Module.[Module Name], Trainer1.[Trainer Name], Employee.EmployeeID, Employee.[Full Name], Employee.Grade, Department.[Department Name], Trainings.TargetPax
FROM Trainer1 INNER JOIN ((Department INNER JOIN Employee ON Department.[Department ID] = Employee.DepartmentID) 
INNER JOIN (([Module] INNER JOIN Trainings ON Module.ModuleID = Trainings.[Module ID])
INNER JOIN [Training Details] ON Trainings.[Training ID] = [Training Details].[Training ID]) 
ON Employee.EmployeeID = [Training Details].[Employee ID]) 
ON Trainer1.TrainerID = Trainings.TrainerID";


$query=odbc_exec($conn,$sql);

while(odbc_fetch_row($query)){


$modulename=odbc_result($query,"Module Name");
$date=odbc_result($query,"Date('Y-m-d')");

echo"  $modulename";
echo "$date<br>";
}

any help will be appreciated..

thanks for anyone out there in advance..

I've never used access, but you should be able to do the processing using PHP

First, convert to returned datetime variable to a unix timestamp
Then apply the date() function to display just the bits you want.

$date=odbc_result($query);
$convert_date = strtotime($date);
$formatted_date = date("Y-m-d", $convert_date);
echo $formatted_date;

Should work...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.