• Function is ok (although if it runs on a server in a different timezone/regional setting it wont be correct, if it was named get_time_minus_1_hour it wouldn't matter).

    How are you using the function?

    This works fine:

    CREATE TABLE testfunc (checkdate datetime)

    INSERT INTO testfunc (checkdate)

    SELECT dbo.fn_get_pst_datetime(DEFAULT)