public class Moment extends java.util.Date implements Compactable
A wrapper around seconds/timestamps. Internally the representation only has second precicion (aligning with Rust), so any numbers passed an/out are always per-second. For any encoding/decoding the 1000 multiplier would be applied to get it in line with JavaScript formats. It extends the base JS Date
object and has all the methods available that are applicable to any Date
Modifier and Type | Class and Description |
---|---|
static class |
Moment.MomentOf
The Substrate MomentOf representation as a Moment.
|
Modifier and Type | Field and Description |
---|---|
static int |
BITLENGTH |
protected java.util.Date |
raw |
Constructor and Description |
---|
Moment(java.lang.Object value) |
Modifier and Type | Method and Description |
---|---|
int |
bitLength()
Returns the number of bits in the value
|
boolean |
eq(java.lang.Object other)
Compares the value of the input to see if there is a match
|
int |
getEncodedLength()
The length of the value when encoded as a Uint8Array
|
boolean |
isEmpty()
Checks if the value is an empty value
|
java.math.BigInteger |
toBn()
Returns the BN representation of the timestamp
|
java.lang.String |
toHex()
Returns a hex string representation of the value
|
java.lang.Object |
toJson()
Converts the Object to JSON, typically used for RPC transfers
|
long |
toNumber()
Returns the number representation for the timestamp
|
java.lang.String |
toString()
Returns the string representation of the value
|
byte[] |
toU8a(boolean isBare) |
after, before, clone, compareTo, equals, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTC
finalize, getClass, notify, notifyAll, wait, wait, wait
getConstructorCodec, toU8a
public int getEncodedLength()
The length of the value when encoded as a Uint8Array
getEncodedLength
in interface Codec
public boolean isEmpty()
Checks if the value is an empty value
public boolean eq(java.lang.Object other)
Compares the value of the input to see if there is a match
public int bitLength()
Returns the number of bits in the value
bitLength
in interface Compactable
public java.math.BigInteger toBn()
Returns the BN representation of the timestamp
toBn
in interface Compactable
public java.lang.String toHex()
Returns a hex string representation of the value
public java.lang.Object toJson()
Converts the Object to JSON, typically used for RPC transfers
public long toNumber()
Returns the number representation for the timestamp
toNumber
in interface Compactable
public java.lang.String toString()
Returns the string representation of the value
toString
in class java.util.Date