Datetime(14) return value differences between MySQL v. 4.x and 3.x

This is a discussion on Datetime(14) return value differences between MySQL v. 4.x and 3.x within the MySQL Database forums, part of the Database Forums category; Hi Is there any way to force the output format of datetime fields in MySQL versions from 4.0? We ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-07-2006
Asteri Hakola
 
Posts: n/a
Default Datetime(14) return value differences between MySQL v. 4.x and 3.x

Hi

Is there any way to force the output format of datetime fields in
MySQL versions from 4.0? We have a few large databases running on v.
3.something and we are running several different applicatons that make
a presumption that the return values of datetime(14) are formatted to
'YYYYMMDDHHMMSS'. However, the new versions seem to return it like
'2006-01-02 12:12:50'. Can I somehow make it return this like
'20060102121250', the way it works on v. 3.x.y?

There are just too many places that would need a change in code that it
wouldn't be possible to handle them all. A few tries of googling
about this didn't give me too much hope. I bet someone has faced the
same problem and solved it.

--
AH
Reply With Quote
  #2 (permalink)  
Old 03-07-2006
Bill Karwin
 
Posts: n/a
Default Re: Datetime(14) return value differences between MySQL v. 4.x and 3.x

"Asteri Hakola" <no.email@com.invalid> wrote in message
news:pan.2006.03.07.15.45.31.975514@com.invalid...
> the new versions seem to return it like
> '2006-01-02 12:12:50'. Can I somehow make it return this like
> '20060102121250', the way it works on v. 3.x.y?


I'm using NOW() as a datetime value in the following examples; you can use
any datetime field or expression.

A datetime value can be coerced to an integer by putting it in an integer
context:
SELECT NOW() + 0;

Or you can format any datetime value with great flexibility using the
DATE_FORMAT() function:
SELECT DATE_FORMAT(NOW(), '%Y%m%d%k%i%s');

See http://dev.mysql.com/doc/refman/4.1/...functions.html
entries for NOW() and DATE_FORMAT().

Regards,
Bill K.


Reply With Quote
  #3 (permalink)  
Old 03-07-2006
Asteri Hakola
 
Posts: n/a
Default Re: Datetime(14) return value differences between MySQL v. 4.x and 3.x

On Tue, 07 Mar 2006 10:34:55 -0800, Bill Karwin wrote:
> I'm using NOW() as a datetime value in the following examples; you can use
> any datetime field or expression.
>
> A datetime value can be coerced to an integer by putting it in an integer
> context:
> SELECT NOW() + 0;
>
> Or you can format any datetime value with great flexibility using the
> DATE_FORMAT() function:
> SELECT DATE_FORMAT(NOW(), '%Y%m%d%k%i%s');


Thanks for your answer, but as far as I understand, this would need
changes to current queries, and changes to software are not possible in
this situation. What I need is backwards compatibility, not rewriting and
compiling code and installing new binaries when just upgrading from v.3 to
v.4 or v.5

--
AH
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:11 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0