Thanks Guys,
Yes, after JamesLean's suggestion when I tried calling function, it gave me a compilation error that "xxx function is not a recognized name", so I just tried adding
DECLARE @dt datetime
SELECT @dt = dbo.xxx( 1, 1 )
and it worked. Anyway thanks a lot for the help
Kris