0

This question already has an answer here:

I want to show the time when blockchain contract called.

I am currently saving the time in the blockchain using a method like this

function userCheckIn(uint placeid) public {
    userCount++;
    checkins[userCount] = Checkin(placeid, msg.sender, new Date(now * 1000));
} 

However, Date says Identifier not found or not unique.

Could you give me any advise, please?

marked as duplicate by Ismael, Richard Horrocks, shane, flygoing, Achala Dissanayake Apr 24 at 14:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You are trying to create a JS object Date. Obviously, it won't work since it's not JS but Solidity.

If you want the current time when the function is called (so mined), you can use now.

Read more here.

  • Thank you! When I used now, that only showed numbers like this 1555650125 1555651118 1555651169 – gnxvw Apr 20 at 5:46

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