Date format problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg

    #1

    Date format problem...

    Isn't the following date format supposed to work with any installation of
    MySQL?

    YYYY-MM-DD HH:NN:SS

    It's not working on one system... the date is shown as all zero's.


  • Aggro

    #2
    Re: Date format problem...

    Greg wrote:[color=blue]
    > Isn't the following date format supposed to work with any installation of
    > MySQL?
    >
    > YYYY-MM-DD HH:NN:SS
    >
    > It's not working on one system... the date is shown as all zero's.[/color]

    Can you show example how to make it show all zeros? I would like to see
    something like this (Except in my example the datetime seems to work fine):


    mysql> create table datetimetest( col1 datetime );
    Query OK, 0 rows affected (0.02 sec)

    mysql> insert into datetimetest values( now() );
    Query OK, 1 row affected (0.00 sec)

    mysql> insert into datetimetest values( '2000-01-01 10:10:22' );
    Query OK, 1 row affected (0.00 sec)

    mysql> select * from datetimetest;
    +---------------------+
    | col1 |
    +---------------------+
    | 2004-07-30 19:59:38 |
    | 2000-01-01 10:10:22 |
    +---------------------+
    2 rows in set (0.01 sec)

    Comment

    • Bill Karwin

      #3
      Re: Date format problem...

      Greg wrote:
      [color=blue]
      > Isn't the following date format supposed to work with any installation of
      > MySQL?
      >
      > YYYY-MM-DD HH:NN:SS
      >
      > It's not working on one system... the date is shown as all zero's.[/color]

      Do you mean the date format when inserting, as in:
      insert into myTable (myDateColumn) values("2004-07-30 10:48:00");

      or do you mean the date format when selecting, as in:
      select date_format(myD ateColumn, "%Y-%m-%d %T") from myTable;

      Regards,
      Bill K.

      Comment

      • Greg

        #4
        Re: Date format problem...

        "Bill Karwin" <bill@karwin.co m> wrote in message
        news:cee1lb01ff @enews3.newsguy .com...[color=blue]
        > Greg wrote:
        >[color=green]
        > > Isn't the following date format supposed to work with any installation[/color][/color]
        of[color=blue][color=green]
        > > MySQL?
        > >
        > > YYYY-MM-DD HH:NN:SS
        > >
        > > It's not working on one system... the date is shown as all zero's.[/color]
        >
        > Do you mean the date format when inserting, as in:
        > insert into myTable (myDateColumn) values("2004-07-30 10:48:00");
        >
        > or do you mean the date format when selecting, as in:
        > select date_format(myD ateColumn, "%Y-%m-%d %T") from myTable;
        >
        > Regards,
        > Bill K.[/color]

        Like your first example. It happens when doing it from an application.
        This is happening with MySQL v4.1 beta on one system (other systems are
        using v4.0)


        Comment

        • Aggro

          #5
          Re: Date format problem...

          Greg wrote:
          [color=blue]
          > Like your first example. It happens when doing it from an application.
          > This is happening with MySQL v4.1 beta on one system (other systems are
          > using v4.0)[/color]

          Echo/Print out the exact query (filled with values, not those containing
          $variable or stuff like that) you are using and copy-paste it here.
          Because most common reason for problems like this is that the query is
          incorrectly formed.

          Comment

          • Greg

            #6
            Re: Date format problem...

            "Bill Karwin" <bill@karwin.co m> wrote in message
            news:cee1lb01ff @enews3.newsguy .com...[color=blue]
            > Greg wrote:
            >[color=green]
            > > Isn't the following date format supposed to work with any installation[/color][/color]
            of[color=blue][color=green]
            > > MySQL?
            > >
            > > YYYY-MM-DD HH:NN:SS
            > >
            > > It's not working on one system... the date is shown as all zero's.[/color]
            >
            > Do you mean the date format when inserting, as in:
            > insert into myTable (myDateColumn) values("2004-07-30 10:48:00");
            >
            > or do you mean the date format when selecting, as in:
            > select date_format(myD ateColumn, "%Y-%m-%d %T") from myTable;
            >
            > Regards,
            > Bill K.[/color]

            Like your first example. It happens when doing it from an application.
            This is happening with MySQL v4.1 beta on one system (other systems are
            using v4.0)


            Comment

            • Aggro

              #7
              Re: Date format problem...

              Greg wrote:
              [color=blue]
              > Like your first example. It happens when doing it from an application.
              > This is happening with MySQL v4.1 beta on one system (other systems are
              > using v4.0)[/color]

              Echo/Print out the exact query (filled with values, not those containing
              $variable or stuff like that) you are using and copy-paste it here.
              Because most common reason for problems like this is that the query is
              incorrectly formed.

              Comment

              Working...