MySQL 0 index date and time functions (mode or typo)?

MySQL 0 index date and time functions (mode or typo)?

am 16.05.2007 18:08:39 von Dwight Altman

In MySQL, regardless of the documentation version,
http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functio ns.html#function
_week I've seen the explanation for receiving a 0 from the WEEK function
depending on the mode setting which causes a range between 0-53.

But what about:
DAYOFMONTH 0 to 31
MONTH 0 to 12

I was wondering if 0 may be for invalid dates, but I get NULL for the
following invalid date:
SELECT MONTH( '1998-14-03' ), DAYOFMONTH( '1998-14-03' )

When might I receive a 0 for these two functions?


Regards,
Dwight

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL 0 index date and time functions (mode or typo)?

am 16.05.2007 23:42:41 von dmagick

Dwight Altman wrote:
> In MySQL, regardless of the documentation version,
> http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functio ns.html#function
> _week I've seen the explanation for receiving a 0 from the WEEK function
> depending on the mode setting which causes a range between 0-53.
>
> But what about:
> DAYOFMONTH 0 to 31
> MONTH 0 to 12
>
> I was wondering if 0 may be for invalid dates, but I get NULL for the
> following invalid date:
> SELECT MONTH( '1998-14-03' ), DAYOFMONTH( '1998-14-03' )
>
> When might I receive a 0 for these two functions?

Best to ask on the mysql list - http://lists.mysql.com/ - they will have
more experience with this sort of thing (and the mysql developers answer
questions there too so they might be able to give you more detail).

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL 0 index date and time functions (mode or typo)?

am 18.05.2007 13:58:11 von itoctopus

Hey,
I think this table is self-explanatory:

First day
Mode of week Range Week 1 is the first week .
0 Sunday 0-53 with a Sunday in this year
1 Monday 0-53 with more than 3 days this year
2 Sunday 1-53 with a Sunday in this year
3 Monday 1-53 with more than 3 days this year
4 Sunday 0-53 with more than 3 days this year
5 Monday 0-53 with a Monday in this year
6 Sunday 1-53 with more than 3 days this year
7 Monday 1-53 with a Monday in this year


--
itoctopus - http://www.itoctopus.com
""Dwight Altman"" wrote in message
news:015501c797d4$7a5d6330$0e00a8c0@IT02...
> In MySQL, regardless of the documentation version,
> http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functio ns.html#function
> _week I've seen the explanation for receiving a 0 from the WEEK function
> depending on the mode setting which causes a range between 0-53.
>
> But what about:
> DAYOFMONTH 0 to 31
> MONTH 0 to 12
>
> I was wondering if 0 may be for invalid dates, but I get NULL for the
> following invalid date:
> SELECT MONTH( '1998-14-03' ), DAYOFMONTH( '1998-14-03' )
>
> When might I receive a 0 for these two functions?
>
>
> Regards,
> Dwight

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Re: MySQL 0 index date and time functions (mode or typo)?

am 18.05.2007 16:11:16 von Dwight Altman

Yes, that table is self-explanatory for WEEK.

I was asking about DAYOFMONTH and MONTH returning 0, since there does indeed
exist an explanation for WEEK returning a 0.

Regards,
Dwight
> -----Original Message-----
> From: itoctopus [mailto:newsgroup@itoctopus.com]
> Sent: Friday, May 18, 2007 6:58 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Re: MySQL 0 index date and time functions (mode or
> typo)?
>
> Hey,
> I think this table is self-explanatory:
>
> First day
> Mode of week Range Week 1 is the first week .
> 0 Sunday 0-53 with a Sunday in this year
> 1 Monday 0-53 with more than 3 days this year
> 2 Sunday 1-53 with a Sunday in this year
> 3 Monday 1-53 with more than 3 days this year
> 4 Sunday 0-53 with more than 3 days this year
> 5 Monday 0-53 with a Monday in this year
> 6 Sunday 1-53 with more than 3 days this year
> 7 Monday 1-53 with a Monday in this year
>
>
> --
> itoctopus - http://www.itoctopus.com
> ""Dwight Altman"" wrote in message
> news:015501c797d4$7a5d6330$0e00a8c0@IT02...
> > In MySQL, regardless of the documentation version,
> > http://dev.mysql.com/doc/refman/4.1/en/date-and-time-
> functions.html#function
> > _week I've seen the explanation for receiving a 0 from the WEEK function
> > depending on the mode setting which causes a range between 0-53.
> >
> > But what about:
> > DAYOFMONTH 0 to 31
> > MONTH 0 to 12
> >
> > I was wondering if 0 may be for invalid dates, but I get NULL for the
> > following invalid date:
> > SELECT MONTH( '1998-14-03' ), DAYOFMONTH( '1998-14-03' )
> >
> > When might I receive a 0 for these two functions?
> >
> >
> > Regards,
> > Dwight
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php