<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Number of Seconds since 2000]]></title><description><![CDATA[<h2><a class="anchor-offset" name="introduction"></a>Introduction</h2>
<p dir="auto">In MIT Scratch, you can already manage dates using the “days since 2000” block. However, if you need a more granular control of date and time, you can use this new block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/90fbd680-f6e6-483a-97e6-f25a45deffc9.png" alt="84a02f2c-9302-495d-9688-a909e3cfd49b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> </p>
<p dir="auto">This block will return the number of seconds that have passed between the given timestamp and the beginning of 2000.01.01.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="input-format"></a>Input Format</h2>
<p dir="auto"> </p>
<p dir="auto">The input is a timestamp, which contains the date, a “T”, and then the time. The date is represented as year:month:day. The time is represented as hour:minute:second. Each field has to be 2 digits, except that the year has to be 4 digits.</p>
<p dir="auto">The timestamp is assumed to be the local time of the computer that’s running this program. If you want to use the UTC time, which is the same across the world, then append a “Z” at the end of the timestamp, such as “2024.01.01T10:00:00Z”.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2f6f5943-f33a-4739-a429-e956bfeac835.png" alt="a03f7006-53e3-4b0a-96fa-299f6a71d685-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">If the input is left empty, then the current time is used:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/18eb3204-4d86-4291-95b5-47cbd5395253.png" alt="84ac9740-6f1c-42b6-bb01-d49156e68cc8-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="calculating-time-difference"></a>Calculating Time Difference</h2>
<p dir="auto"> </p>
<p dir="auto">With this new block, you can easily calculate how many seconds are between 2 timestamps. You just need to run this new block for both timestamps, then calculate the difference between them:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2582ee61-98ea-49e0-9922-54034db8c778.png" alt="b752552c-7bf4-440b-b9c7-d97d01def797-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="converting-to-date"></a>Converting to Date</h2>
<p dir="auto"> </p>
<p dir="auto">You can also convert the number of seconds back to a Date object. For example, the program below first gets the number of seconds for a specific timestamp, then create a date object using that result, and we get the same timestamp as our input:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f8e3b271-a012-4677-8717-7fbd5a814a75.png" alt="5b827cfc-00b2-482b-8755-78c69995af2d-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.creaticode.com/topic/1510/number-of-seconds-since-2000</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 05:16:17 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/1510.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Sep 2024 01:44:54 GMT</pubDate><ttl>60</ttl></channel></rss>