On 24-Mar-2003 Michael Shulman wrote:
> It looks like it's in now() format, but without the punctuation.  The
> line
> from your insert statement is 

Nope, that's a MySQL timestamp. 

UNIX_TIMESTAMPS are # of seconds from the epoch (Jan 1 1970).

"nobody" <[EMAIL PROTECTED]> is trying to store an INT in a timestamp column and
probably clobbering his values.

> 
> 20030323225645
> 
> If we break this apart, we see:
> 
> Year = 2003
> Month = 03
> Date = 23
> Hour = 22 (or 10pm)
> Minute 56
> Seconds 45
> 

Nope, that's a MySQL timestamp. 

UNIX_TIMESTAMPS are # of seconds since the epoch (Jan 1 1970).

nobody <[EMAIL PROTECTED]> is probably trying to store an INT in a timestamp
column and clobbering his values as the timestamp updates.


> Someone else on the list: where or how is the timezone encode, or this is
> entry in GMT? Is there a way to determine the local timezone on the
> machine?
> 

mysql> show variables like 'timezone';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| timezone      | PST   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> select sec_to_time((time_to_sec(now()) - UNIX_TIMESTAMP()) % 86400)
as 'offset GMT';
+------------+
| offset GMT |
+------------+
| -08:00:00  |
+------------+
1 row in set (0.00 sec)

> 
> -----Original Message-----
> From: nobody [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, March 23, 2003 12:56 PM
> To: [EMAIL PROTECTED]
> Subject: date problem
> 
> Hello mysql,
> 
> I do this:
> 
> $query = "INSERT INTO news(ID, author, title, text, date) VALUES(NULL,
> '".$_SESSION["ulogged"]."', '".$title."', '".$text."',
> UNIX_TIMESTAMP(NOW()))";
> $result = mysql_query($query, $connection) or die("problem with query");
> 
> I get this:
> 
> mysql> select * from news where id='1';
> +----+--------+----------+----------------------------+----------------+
>| ID | author | title    | text                       | date           |
> +----+--------+----------+----------------------------+----------------+
>|  1 | myuser | news     | blah blah blah             | 20030323225645 |
> +----+--------+----------+----------------------------+----------------+
> 1 row in set (0.01 sec)
> 
> Look at the time! It's set ... strange :) 2003 03 23 22 56 45 .. it's
> not neither now() format, neither unix_timestamp() format.
> 
> mysql> select now(), unix_timestamp(now());
> +---------------------+-----------------------+
>| now()               | unix_timestamp(now()) |
> +---------------------+-----------------------+
>| 2003-03-23 23:07:30 |            1048453650 |
> +---------------------+-----------------------+
> 1 row in set (0.01 sec)
> 
> It's okay. So, why in the query from a php form the unix time date is
> saved wrong? Any ideas and suggestions?
> 
> -- 
> best wishes,
> Strahil Minev a.k.a. DLHelper,
> BuFu TeaM                         mailto:[EMAIL PROTECTED]
> 

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to