Hi guys (newbie here so be nice!!!) :o
Im currently converting a snitz asp forum into my own made php forum. Completly different script but using the snitz database layout.
The dates that are stored in this database (for post/topic dates are stored in this format:
20041105155011
14 string of numbers. Because im basing this on the snitz database layout I need to stick with this format.
Im outputting this dateusing the following:
function formatDate($val)
{
if ($val==""){return "unknown";}
// split up the timestamp
$year=substr($val,0,4);
$month=substr($val,4,2);
$day=substr($val,6,2);
$hh=substr($val,8,2);
$mm=substr($val,10,2);
// convert it into a standard timestamp and format it
// convert it into a standard timestamp and format it
$date = date("d M Y, H:i", mktime($hh, $mm, 0, $month, $day, $year));
return $date;}
echo formatDate($date) ;
which is working fine.
But im having a problem getting this date in this format to be inserted into the database.
$timestamp = date();
$QueryInsert = "INSERT INTO forum_topics (T_DATE)
VALUES ('$timestamp')";
$result = mysql_query ($QueryInsert)or die(mysql_error());
$insID = mysql_insert_id();
But thats causing the error: Wrong parameter count for date()
I have tried other such as NOW() strtotime()
but it either doesnt write to the database in the correct 14 diget string that I need, or it just renders and error.
arghhh!!! can anyone help me?