List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 17 1999 12:38am
Subject:Re: Saving dates as YYYYMMDD
View as plain text  
>>>>> "Daniel" == Daniel E White <igor@stripped> writes:

<cut>

Daniel> That is doing it a bit sideways, my friend.
Daniel> You want to avoid using the NOW() function to fill a TIME data-type.
Daniel> I found you need to use CURTIME() or CURRENT_TIME to get TIME_FORMAT to behave.
>  
Daniel> Also, there are the DATE_FORMAT and TIME_FORMAT functions that allow for more
> flexibility.

Daniel> Observe:
Daniel> -------------------------

mysql> CREATE TABLE time_table (date_field DATE, time_field TIME, datetime_field
> DATETIME );
Daniel> Query OK, 0 rows affected (0.20 sec)

mysql> INSERT INTO time_table VALUES
-> ( NOW(), CURTIME(), NOW()) ,
-> ( NOW(), NOW(), NOW() );
Daniel> Query OK, 2 rows affected (0.03 sec)
Daniel> Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from time_table ;
Daniel> +------------+------------+---------------------+
Daniel> | date_field | time_field | datetime_field      |
Daniel> +------------+------------+---------------------+
Daniel> | 1999-09-14 | 20:49:01   | 1999-09-14 20:49:01 |
Daniel> | 1999-09-14 | 356:49:01  | 1999-09-14 20:49:01 |
Daniel> +------------+------------+---------------------+
Daniel> 2 rows in set (0.01 sec)

Hi

I have now fixed the problem with TIME columns in this context for the 
next MySQL 3.23 version.

Regards,
Monty

Thread
Saving dates as YYYYMMDDClaudia M. Castaneda14 Sep
  • Re: Saving dates as YYYYMMDDMike Machado14 Sep
    • Re: Saving dates as YYYYMMDDMartin Ramsch14 Sep
  • Re: Saving dates as YYYYMMDDChristian Mack14 Sep
    • Re: Saving dates as YYYYMMDDDaniel E. White15 Sep
      • Re: Saving dates as YYYYMMDDMichael Widenius17 Sep
  • Re: Saving dates as YYYYMMDDChristian Mack15 Sep
    • Re: Saving dates as YYYYMMDDMartin Ramsch16 Sep
      • Re: Saving dates as YYYYMMDDMichael Widenius17 Sep