Subject | Re: [firebird-support] fb book error? |
---|---|
Author | Martijn Tonies |
Post date | 2007-09-24T18:40:47Z |
> It's actually quite interesting that the range is 0-365 since all theother
> day of year functions I know return 1-366.0-11).
> .NET
> DateTime.DayOfYear
>
> Borland
> DayOfTheYear
>
> Oracle
> SELECT {fn DAYOFYEAR('2007-01-01')} FROM DUAL;
>
> MS-SQL
> SELECT DATEPART( "dayofyear", '01 JAN 2007' );
>
> MySQL
> DAYOFYEAR(date)
>
> DB2
> EXTRACT(DAYOFYEAR FROM '01 JAN 2007')
>
> PostgreSQL
> SELECT EXTRACT(DOY FROM TIMESTAMP '2007-01-01');
>
> SmallSQL
> DAYOFYEAR(date)
>
> More interestingly though is that the SQL:2003 standard's definition does
> not specifically state the values for days only months (which must be
> Which means that Firebird's implementation although it goes against theNot that useless ;-)
> grain falls in line with the standard precedent set for "MONTH".
>
> Sorry useless bit of reading for any interested.
Whenever it comes to ordinals etc, SQL always starts at 1.
For example: ORDER BY 1 (not 0!)
I believe that this particular use of 0..365/366 comes from an
implementation
mistake in IB 6.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com