This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I have standard delphi function which conver datetime to filedatetime here is the description function DateTimeToFileDate(DateTime: TDateTime): Integer; Description Use DateTimeToFileDate to convert a TDateTime value, which is the representation of date-and-time values used by the VCL, to a DOS date-and-time value. For example, use DateTimeToFileDate to convert a TDateTime value to a format that can be used as the Age parameter of FileSetDate. You may also need to use DateTimeToFileDate to convert a TDateTime so that it is compatible with the Time field of the TSearchRec record used by the FindFirst and FindNext functions. Lo returns the low-order Byte of the argument X as an unsigned value. X is an expression of type Integer. Use Hi to obtain the high-order byte of an expression of type Word or Integer. Note: Hi treats Integer as a 16-bit value, even if it is 32-bit. This is the delphi code that convert the date year=2003 month=5 day=28 sec=57 min=45 hr=13 msec=107
LongRec(Result).Lo := (Sec shr 1) or (Min shl 5) or (Hour shl 11); LongRec(Result).Hi := Day or (Month shl 5) or ((Year - 1980) shl 9);
output Result is --> 784100796 Any help will be highly appreciated. Thanks.
Sounds like you have a good handle on the requirements. If you look what is going on, you break the date into it's field elements. A good canidate for this portion would be Calendar. Then these values are shifted by the amounts lists, the results ored together and the High shifted and ored to the low. I took a quick stab at this and here is the code I came up with: