Move.

Post

Share your knowledge.

doodee.
Apr 01, 2025
Expert Q&A

Can you get a timestamp when an object is created in Move?

Hey there! I'm working with Move and I'm curious if it's possible to get a timestamp of when an object is created. I've seen something about using sui::clock to capture this, but I was wondering if there's a native way to access this timestamp directly in Move code without additional attributes or if we can avoid additional computations. Any insights?

  • Move CLI
  • Move
2
2
Share
Comments
.

Answers

2
elfDani.
Apr 1 2025, 14:19

You can capture the timestamp during the creation of the object as an attribute using sui::clock, like timestamp_ms. This method involves adding an attribute to store 'time_ms' from the shared Clock object.

1
Comments
.
YJS.
YJS94
Apr 1 2025, 14:52

To access timestamps directly in Move, without adding attributes, isn't inherently supported. The best approach seems to be utilizing the shared Clock object or referring to transaction data post-creation.

1
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info