[thelist] date time query
Hassan Schroeder
hassan at webtuitive.com
Thu Jul 29 01:04:23 CDT 2004
Mark Groen wrote:
> INSERT INTO bowenonline (id, datestamp, thread, parent, author,
> subject, email)
> SELECT id, CONCAT(postdate + time) AS datestamp, thread, parent,
> author, subject, email FROM forum;
>
> The datestamp field gets populated with the default 0000-00-00
> 00:00:00 instead of something like 1999-01-01 12:01:01. The datestamp
> field is a DATETIME type and the postdate is DATE and time is TIME.
You could CONCAT things together if they were strings -- but in this
case they're not. :-)
try
... FROM_UNIXTIME(UNIX_TIMESTAMP(postdate) + TIME_TO_SEC(time)) AS
datestamp, ...
HTH,
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the thelist
mailing list