Skip to content

Time and date

How to get the current time

Use the now() method to obtain the current standard Unix time.

If you need to store the time in state or encode it in a message, use the following serialization: Int as uint32.

let currentTime: Int = now();
if (currentTime > 1672080143) {
// do something
}
▶️ Open in Web IDE