Professional Web Applications Themes

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

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 ...

  1. #1

    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
    Asteri Hakola Guest

  2. #2

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

    "Asteri Hakola" <no.emailcom.invalid> wrote in message
    news:pan.2006.03.07.15.45.31.975514com.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 [url]http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html[/url]
    entries for NOW() and DATE_FORMAT().

    Regards,
    Bill K.


    Bill Karwin Guest

  3. #3

    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
    Asteri Hakola Guest

Similar Threads

  1. Replies: 3
    Last Post: August 10th, 01:13 AM
  2. Differences between MySQL 5 and MaxDB?
    By Duane Phillips in forum MySQL
    Replies: 5
    Last Post: November 3rd, 01:48 AM
  3. DateTime being adjusted for time zone differences
    By James Cline in forum ASP.NET Web Services
    Replies: 0
    Last Post: September 24th, 03:57 PM
  4. MySQL datetime extraction
    By Yasir Malik in forum PHP Development
    Replies: 1
    Last Post: July 19th, 07:27 PM
  5. [PHP] MySQL datetime extraction
    By David Nicholson in forum PHP Development
    Replies: 2
    Last Post: July 19th, 06:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139