Timestamps
SmartPy's type for timestamps is sp.timestamp
. It corresponds to the timestamp
type in Michelson.
There are two ways to specify a literal timestamp:
sp.timestamp(n)
refers to the moment in timen
seconds since the Epoch. For example,sp.timestamp(1571659294)
represents 2019-10-21T12:01:34Z.sp.timestamp_from_utc(year, month, day, hours, minutes, seconds)
represents the given time in UTC. For examplesp.timestamp_from_utc(2021, 12, 31, 23, 59, 59)
corresponds to 2021-12-31T23:59:59Z.
- sp.now →
The current block timestamp, a.k.a. the "minimal injection time". For a detailed explanation see Michelson's
NOW
instruction.