From Test-Scratch-Wiki

类别 侦测类积木
形狀 椭圆形积木
加入於 2.0

The Days Since 2000 积木 is a 侦测类积木 and a 椭圆形积木. It reports the amount of days (and fractions of a day) since 00:00:00 1 January 2000 (UTC), and is a replacement of the Scratch 日迄今日数 block, which never made the official release of 2.0.

It is one of the two date/time blocks in Scratch. The other is 目前时间的 (), which reports the date or time. Both these blocks can be worked in unison with one another for a variety of time-related scripts and projects.


This block can be used in some of the following ways:

  • Making a countdown
說出 (字串組合 ((9132) - (2000年迄今日數)) 和 [ days till 2025!])
  • Making something unavailable before or after a certain date
如果 <(2000年迄今日數) < (5479)> 那麼 
  變數 [money v] 改變 [1000]

  說出 [This feature is unavailable after 2015.]
  • Corresponding real-life events with projects
定義 mark (event) for (value) days from now
新增項目 ((2000年迄今日數) + (value)) \( [eventDates v] \)
新增項目 (event) \( [eventNames v] \)

定義 search calendar for (event)
變數 [i v] 設為 (0)
重複直到 <<(i) > (清單 [eventNames v] 的項目數 :: list)> 或 <(清單第 (i) 項項目\( [eventNames v] \) :: list) = (event)>> 
  變數 [i v] 改變 (1)
如果 <(i) > (清單 [eventNames v] 的項目數 :: list)> 那麼 
  變數 [output v] 設為 (字串組合 (字串組合 [Your search for ] 和 (event)) 和 [ was not found.])

  如果 <(2000年迄今日數) < (清單第 (i) 項項目\( [eventDates v] \) :: list)> 那麼 
    變數 [output v] 設為 (字串組合 (字串組合 (字串組合 (字串組合 [Your event ] 和 (event)) 和 [ is in ]) 和 ((清單第 (i) 項項目\( [eventDates v] \) :: list) - (2000年迄今日數))) 和 [ days])
    如果 <(2000年迄今日數) = (清單第 (i) 項項目\( [eventDates v] \) :: list)> 那麼 
      變數 [output v] 設為 (字串組合 (event) 和 [ is today!])
      變數 [output v] 設為 (字串組合 (字串組合 [This event happened ] 和 ((2000年迄今日數) - (清單第 (i) 項項目\( [eventDates v] \) :: list))) 和 [ days ago.])


Main article: List of Block Workarounds

Where d = days since 2000:

變數 [d v] 設為 ((((367) * (year)) - ([floor v] 數值 (((7) * ((year) + ([floor v] 數值 (((month) + (9)) / (12))))) / (4)))) + ((([floor v] 數值 (((275) * (month)) / (9))) + (day)) - (730530)))
如果 <(d) < [-36435]> 那麼 
  變數 [d v] 改變 (1)
如果 <(d) < [-72990]> 那麼 
  變數 [d v] 改變 (1)
如果 <(d) > [36585]> 那麼 
  變數 [d v] 改變 (-1)
變數 [d v] 改變 (-1)

Correct from 1800-2199.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.