The best way (after having tried at least four different ones) is dependency injection: pass a Clock object or now function to the relevant entrypoint and manipulate that in the test. In pseudo-Python, your test would look something like this:
def function_under_test(foo, bar, clock):
if foo.created < clock.now() + timedelta(days=7):
frobnicate(foo)
Your test would then look like this:
def test_should_frobnicate_foo_if_more_than_a_week_old(self):
clock = StaticClock(datetime.datetime(2000, 1, 1))
foo = Foo(clock) # Sets the creation date to clock.now()
function_under_test(foo)
self.assertTrue(foo.frobnicated)