Post
Share your knowledge.
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
Answers
2You 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.
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.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.