![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We have a time dimension with Day as one of the levels. This seems to be returning the incorrect day based off a date number. For example, the number 38589 represents the '25 August 2005'. When using the DAY("dbo"."deal"."tradedate") function the day returned is 27 and not 25. Does anyone have an idea as to why. The same with the functions DATEPART. Thanks in advance |
#3
| |||
| |||
|
|
There is a difference between day 0 for SQL and the VBA functions running the following in a debug window in Excel: ?format(cdate(0),"dd mmm yyyy") Produces "30 Dec 1899" Running the following from Query Analyser: select convert(datetime,0) Produces '1900-01-01 00:00:00.000' (2 days later!) So if you are swapping between using VBA and T-SQL functions for dealing with dates you will need to adjust for this variation between day 0. -- Regards Darren Gosbell [MCSD] dgosbell_at_yahoo_dot_com Blog: http://www.geekswithblogs.net/darrengosbell In article <uSOOaYGtFHA.3528 (AT) TK2MSFTNGP15 (DOT) phx.gbl>, d@l.com says... We have a time dimension with Day as one of the levels. This seems to be returning the incorrect day based off a date number. For example, the number 38589 represents the '25 August 2005'. When using the DAY("dbo"."deal"."tradedate") function the day returned is 27 and not 25. Does anyone have an idea as to why. The same with the functions DATEPART. Thanks in advance |
![]() |
| Thread Tools | |
| Display Modes | |
| |