Code: Select all
$query = "INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', CURDATE() + CURTIME())";Moderator: General Moderators
Code: Select all
$query = "INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', CURDATE() + CURTIME())";Why not store the date with a php unix timestamp, then from that you can get any time and/or date format you want.$query = "INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', CURDATE() + CURTIME())";
Code: Select all
$query = "INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', ".time().")";Code: Select all
date("d m Y" , *UNIX TIMESTAMP FROM DB*)Code: Select all
$date_time = date("Y:m:d:H:i:s");
$query = "INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', '$date_time')";JAB Creations wrote:... since essentially the MySQL documentation severely lacks any useful examples, tutorial sites are doing mostly useless/static crap ...
I don't believe it - give an example.JAB Creations wrote:Hi Vlad, I tried that stuff out and was never able to merge the date and time together in to a single row/column.
mysql> SELECT NOW();
-> '2007-12-15 23:50:26'
Code: Select all
INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', CONCAT(CURDATE(), ' ', CURTIME()))
INSERT INTO accounts (username, password, email, date_0) VALUES ('$username', '$password', '$email', NOW())
sql has its own one...time()
Code: Select all
UNIX_TIMESTAMP()Code: Select all
FROM_UNIXTIME(unix timestamp, format)Code: Select all
FROM_UNIXTIME(unix timestamp, '%d %m %Y')