Uuups, on my previous comment I had to make a change to the unit tests (after the UDF definition). I didn't use the variable @dt in all cases where I should have...
PeteK I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.