I am pulling a date value from a MySQL DB formatted as 01/20/13 I am calling the PHP date function on this value returned to get what day of the week it is, so 01/20/13 is today’s date which is Sunday but it keeps returning the value Wednesday. I have included the code below I am new to programming so this is probably a stupid error I am overlooking.
<?php
require '../TimeCard/DB.php';
try{
$stmt = $conn->prepare('SELECT `date` FROM `timeRecords` WHERE `employeeID`= 1 ');
$stmt->execute();
} catch(PDOException $e){
echo'ERROR: ' . $e->getMessage();
}
while($row = $stmt->fetch())
{
echo date("l", $row['date']) . "<br>";
echo $row['date'] . "<br>";
}
?>
Mysql does not store dates as m/d/y it stores them as Y-m-d you’re mysql database will turn “01/20/13” into 0000-00-00.
However, if you are not using the date type, and storing as a string use