I'm trying to make this work, but are having some problems?!?
I use a javascript to get the users local date & time and that part works perfect, but when I try to insert it into the table it comes out like this: 0000-00-00 00:00:00?
How do I get this in to my db table in a date/time field?
<script type="text/javascript">
function GetTime() {
var now = new Date();
var test = now.getFullYear() + '-' +
(now.getMonth() < 9 ? '0' : '') + (now.getMonth()+1) + '-' +
(now.getDate() < 10 ? '0' : '') + now.getDate() + ' ' +
(now.getHours() < 10 ? '0' : '') + now.getHours() + ':' +
(now.getMinutes() < 10 ? '0' : '') + now.getMinutes() + ':' +
(now.getSeconds() < 10 ? '0' : '') + now.getSeconds()
;
document.write(test);
}
</script>
<?
$localDate = "<script language=javascript>GetTime();</script>";
echo $localDate;
mysql_query("INSERT INTO ".$prefix."_users (fname,lname,email,date) VALUES ('$fname','$lname','$email','$localDate')");
?>
Thanks in advance :-)