I am new to Tezos Block chain and I am writing a smart-contract for crowdfunding using smartPy. For this I need current date time of Tezos Block chain. So, can anyone help me out, how to find out this? I had tried sp.now method but I am not able to implement it. Any help will be appreciated. Thanks

2 Answers 2


As you have already discovered, the sp.now attribute should give you access to the current timestamp. You can see an example of this method in the "Mini-kitties" example that you can load in the SmartPy.io IDE (File > Load Template > Mini Kitties). Specifically in the entry point buy, you'll find:

def buy(self, params):
    kitty = self.data.kitties[params.kittyId]
    sp.verify(sp.mutez(0) < kitty.price)
    sp.verify(kitty.price <= params.price)
    sp.verify(sp.amount == params.price)
    sp.send(kitty.owner, params.price)
    kitty.owner = sp.sender
    sp.if kitty.isNew:
        kitty.isNew = False
        kitty.auction = sp.now.addSeconds(self.newAuctionDuration)
    sp.verify(sp.now <= kitty.auction)
    sp.if sp.now <= kitty.auction:
        kitty.price = params.price + sp.mutez(1)

Simply use 'sp.now', not 'sp.now()' or anything else. It's not a method, it's an expression that happens to do what you want.

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.