I've created a dateTime in php which is added to a database and the formatting is very strange. In the program it is written out like this:
$postTime = new DateTime();
$stringTime = $postTime -> format('d/m/y H:i:s');
and I have also tried it using dashes like d-m-y which gives the same results. For some odd reason the year seems to wrap around the rest of the date:
As you can see the date seems to format itself like this YYDD-MM-YY. Any ideas why this is happening, I haven't found any similar problems searching online unless I was just searching the wrong things. If so, sorry in advance!
Method for inserting the data:
$sql = "INSERT INTO Post (postTitle, postDescription, postLocation, postTime, UserID) VALUES ('$postTitle', '$postDesc', '$postLocation', '$stringTime', '$userID')";
if(mysqli_query($connection, $sql)) {
echo "success.";
}else{
echo mysqli_error($connection);