I deployed a smartpy contract in florencenet via smartpy.io. The command sp.timestamp_from_utc_now() used inside the program seems to be not giving the current time. Instead it is giving the same time the contract is deployed. How do I get the current time/timestamp in smartpy?

1 Answer 1


sp.timestamp_from_utc_now() is a helper function that only works at compilation time, meaning that it produces a constant and doesn't update at runtime.

timestamp_from_utc_now() should be moved to sp.utils soon, which should avoid confusion.

You want to use the instruction sp.now which gives the current block timestamp.

  • 1
    thanks a lot, @Rodrigo Quelhas. Your suggestion worked as per my requirement.
    – MrHumble
    Commented Jul 23, 2021 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.