REST API Timestamp Epoch

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Oliver-SP

New Member
Jul 14, 2022
2
0
1
Canada
Hello,
Some responses from the API (https://api.modpacks.ch/public/modpack/{id} in this case) have timestamps in it (like the updated property), but the timestamps are not formatted in direct Unix Epoch time; So I'm wondering what the FTB API considers as it's 0 timestamp so that I can correctly read the timestamps that are returned, or how to get the correct datetime from that number.

For example:
Requesting GET https://api.modpacks.ch/public/modpack/1 returns an object with the updated property set to 1585685146 (at the time of writing this) and when making this a Javascript Date object it turns into the datetime 1970-01-19T08:28:05.146Z.

Thanks for any assistance that is able to be provided.
 
Last edited:
Replying for anyone else who has the same question:

The timestamps are in seconds from the Unix epoch, not milliseconds, so multiply it by 1000 before generating the date.
 
The timestamps are in seconds from the Unix epoch, not milliseconds, so multiply it by 1000 before generating the date.
 
Last edited by a moderator: