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";



$modulename=odbc_result($query,"Module Name");

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

any help will be appreciated..

thanks for anyone out there in advance..

Edited by Reverend Jim: Fixed formatting

6 Years
Discussion Span
Last Post by nonshatter

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.

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

Should work...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.