Format of the timestamp in timestamp extrinsic?
See original GitHub issueHello, I found that for recent blocks (polkadot) the timestamp extrinsic is parsed with extrinsic['call']['call_args']['type'] == 'Moment'
and value is some rather big number (e.g. for block 7313001 it is 1634560404001) - clearly it is not a Unix timestamp. How can I parse this number into timestamp?
I’ve used to parse timestamp values as strings in format '%Y-%m-%dT%H:%M:%S.%f'
, but it worker for timestamps with extrinsic['call']['call_args']['type'] == 'Compact<Moment>'
.
Now when the call value is integer, I need to introduce some changes to my code, but I can’t find what format the timestamp value is.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Timestamps, Time Zones, Time Ranges, and Date Formats
Learn how Sumo Logic manages timestamps, time zones, time ranges, and dates, and the configuration options that are available.
Read more >timestamp formats - IBM
The format options of timestamp combine the formats of the date and time data types. The default timestamp format is as follows: %yyyy-%mm-%dd...
Read more >polkadot js - Can we query blocks by (extrinsics) timestamp?
Just want to confirm that the first argument of extrinsic timestamp seems to be the conventional way. See example in Subquery tutorial.
Read more >Get system time in scope of substrate pallet - Stack Overflow
In the case of pallet-timestamp, this will check that the inherent extrinsic setting the timestamp in the block set a sensible time.
Read more >Timestamp (Java Platform SE 8 ) - Oracle Help Center
Formats a timestamp in JDBC timestamp escape format. yyyy-mm-dd hh:mm:ss.fffffffff , where ffffffffff indicates nanoseconds. Overrides: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you don’t care for ms precision then simply divide by 1000 and round down
On Mon, Oct 18, 2021 at 16:32, stolpa4 @.***> wrote:
After some discussion how to deal with the
Moment
type it will be consistently treated as anu64
as per the Substrate codebase, also for pre-MetadataV14 runtimes. Conversion to e.g. a datetime will be up to the application.