Mike Little wrote:
>
> Apologies for not using mysql-bug (it requires a *nix machine with a configured mail
> system)
>
> I have discovered a problem with date_format(), it is interpreting formatting chars
> it 'knows' even without a preceding '%'
>
> mysql> SELECT DATE_FORMAT(NOW(),'%W, %e %M %Y %H:%i:%S GMT') as today,
> VERSION()\G
> *************************** 1. row ***************************
> today: Tuesday, 11 May 1999 14:15:49 GMay14:15:49
> version(): 3.22.20a
> 1 row in set (0.00 sec)
>
> and on another machine
>
> mysql> SELECT DATE_FORMAT(NOW(),'%W, %e %M %Y %H:%i:%S GMT') as today,
> VERSION()\G
> *************************** 1. row ***************************
> today: Tuesday, 11 May 1999 13:56:39 GMay13:56:39
> version(): 3.22.21
> 1 row in set (0.00 sec)
>
> (Yes I have just spotted that the two machines are nowhere near in sync with each
> other.)
>
> These are both running Linux (RedHar 5.2 kernel 2.0.36)
>
> And under Windows NT
>
> mysql> SELECT DATE_FORMAT(NOW(),'%W, %e %M %Y %H:%i:%S GMT') as today,
> VERSION()\G
> *************************** 1. row ***************************
> today: Tuesday, 11 May 1999 15:00:09 GMay15:00:09
> version(): 3.22.22
> 1 row in set (0.00 sec)
>
> (This one has a much more accurate time)
>
> UPDATE:
> Having looked at the source in item_timefunc.cc
> It looks like the manual (3.22.22) is ahead of the source and in fact '%' is not
> required at all.
>
> Which I've just verified...
>
> mysql> SELECT DATE_FORMAT(NOW(),'W, e M Y T ') as today, VERSION() \G
> *************************** 1. row ***************************
> today: Tuesday, 11 May 1999 14:46:24
> version(): 3.22.20a
> 1 row in set (0.00 sec)
>
> So I guess the leading % is going to be in the next version.
>
> And how about an extension to get the timezone of the server machine into the
> Date_Format() string?
>
> Mike
Hi Mike
This is correct.
In 3.22.xx the '%' sign is optional.
In 3.23.xx it will be a must.
So if you want to append 'GMT' now, you have to use the CONCAT() function.
Tschau
Christian