November 6, 2017 at 9:49 pm
Comments posted to this topic are about the item More Precedence
November 6, 2017 at 9:53 pm
That is really interesting.
Pity this cannot be effected on the new datetime datatypes (e.g. datetime2)
thanks for the question, Avinash
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
βlibera tute vulgaris exβ
November 7, 2017 at 1:47 am
Is there an explanation why 0x20 (32) results in 107 milliseconds?
November 7, 2017 at 4:21 am
Mighty - Tuesday, November 7, 2017 1:47 AMIs there an explanation why 0x20 (32) results in 107 milliseconds?
Spoiler:
Ë™sɯㄥ0Æ– xoɹddÉ sá´‰ Çsoɥʇ ÉŸo á„…Æ ;puoÉ”Çs É ÉŸo ɥʇ00Æ/Æ– sá´‰ ÇdʎʇÉʇÉp ÇɯᴉʇÇʇÉp Çɥʇ uá´‰ Çɯᴉʇ ÉŸo uoá´‰sᴉʌᴉpqns ʇsÇllÉɯs Çɥ┴
Thomas Rushton
blog: https://thelonedba.wordpress.com
November 7, 2017 at 6:05 am
ThomasRushton - Tuesday, November 7, 2017 4:21 AMMighty - Tuesday, November 7, 2017 1:47 AMIs there an explanation why 0x20 (32) results in 107 milliseconds?Spoiler:
Ë™sɯㄥ0Æ– xoɹddÉ sá´‰ Çsoɥʇ ÉŸo á„…Æ ;puoÉ”Çs É ÉŸo ɥʇ00Æ/Æ– sá´‰ ÇdʎʇÉʇÉp ÇɯᴉʇÇʇÉp Çɥʇ uá´‰ Çɯᴉʇ ÉŸo uoá´‰sᴉʌᴉpqns ʇsÇllÉɯs Çɥ┴
That spoiled it! π
November 7, 2017 at 11:15 am
Adding a binary value to datetime is not the same as adding an integer value. - this I know.
Adding 32 to datetime adds 32 days
Adding x20 to datetime adds 107 milliseconds
WHY - THAT I DON'T KNOW, YET!!
November 7, 2017 at 11:50 am
Because it isn't adding 32 to the date time value:
NewDate DateAsBinary NewDateAsBinary
----------------------- ------------------------------------------------------------------ ------------------------------------------------------------------
2001-01-01 00:00:00.107 0x0000901A00000000 0x0000901A00000020
November 7, 2017 at 12:00 pm
That I can understand. However π
Where is the logic in doing a calculation in a different datatype than what the result will be displayed as?
November 7, 2017 at 12:01 pm
OH and BTW thank you for your answer.
November 8, 2017 at 5:44 am
I enjoy date math. Thomas explained the answer above.
If you add an integer to a datetime data type, it adds that number of days and returns the correct datetime. This meets the standard of date + interval = new date.
Not so with datetime2. It gives an operand type clash error.
The one that really gets me is the date data type. It gives the same error.
Microsoft did a lot of things right with the datetime type, but missed the boat with the newer ones. I don't know why they made the decisions they did.
DATEADD works with both, but not straight addition and subtraction.
November 8, 2017 at 12:43 pm
Budd - Tuesday, November 7, 2017 12:00 PMThat I can understand. However π
Where is the logic in doing a calculation in a different datatype than what the result will be displayed as?
In this particular case (binary level), probably nothing other than finding out if you actually know how the DATETIME datatype works. In real life, I use direct date math a lot (but not at the binary level).
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply