<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Setting_the_Time</id>
	<title>Setting the Time - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Setting_the_Time"/>
	<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Setting_the_Time&amp;action=history"/>
	<updated>2026-05-19T21:17:31Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Setting_the_Time&amp;diff=1660&amp;oldid=prev</id>
		<title>Patarakin: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Setting_the_Time&amp;diff=1660&amp;oldid=prev"/>
		<updated>2022-07-21T08:33:13Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 11:33, 21 июля 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Patarakin</name></author>
	</entry>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Setting_the_Time&amp;diff=1659&amp;oldid=prev</id>
		<title>scratch&gt;CrazyBoy826: clean</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Setting_the_Time&amp;diff=1659&amp;oldid=prev"/>
		<updated>2022-05-09T19:24:26Z</updated>

		<summary type="html">&lt;p&gt;clean&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;With [[Scratch 3.0]]&amp;#039;s time [[Reporter Blocks|reporter]] capabilities, displaying the time or creating a [[string]] of the current time is possible. However, using the &amp;lt;sb&amp;gt;(current [hour v])&amp;lt;/sb&amp;gt; block displays a 24-hour clock, which means it uses {{wp|Military time}} instead of using ‘a.m.’ and ‘p.m.’ There are also some other problems. This tutorial shows how to properly display the time to one&amp;#039;s liking as an alternative to joining the basic time capabilities provided by the [[Current () (block)|&amp;lt;sb&amp;gt;current [ v]&amp;lt;/sb&amp;gt; block]].&lt;br /&gt;
&lt;br /&gt;
== Programming ==&lt;br /&gt;
One of the issues with the &amp;#039;&amp;#039;&amp;#039;current ()&amp;#039;&amp;#039;&amp;#039; block is that minutes and seconds are not zero-padded, meaning they do &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; have a &amp;quot;0&amp;quot; before single-digit values. For example, time may be displayed realistically as:&lt;br /&gt;
&amp;lt;pre&amp;gt;1:04:07 p.m.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Meaning it is 1 hour, 4 minutes, and 7 seconds past 12:00 p.m. However, joining the strings together, [[Scratch]] would normally display the time as:&lt;br /&gt;
&amp;lt;pre&amp;gt;13:4:7&amp;lt;/pre&amp;gt;&lt;br /&gt;
To work around this, [[variable]]s can be used to designate the realistically correct value for each time unit, and then they can be joined together as a string. To fix the 24-hour issue, one can add -12 to the hour if it reaches a certain time. For the following script, assume:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sb&amp;gt;(hour)&amp;lt;/sb&amp;gt; is the variable used to display the current hour&lt;br /&gt;
* &amp;lt;sb&amp;gt;(minute)&amp;lt;/sb&amp;gt; is the variable used to display the current minute&lt;br /&gt;
* &amp;lt;sb&amp;gt;(second)&amp;lt;/sb&amp;gt; is the variable used to display the current second&lt;br /&gt;
* &amp;lt;sb&amp;gt;(half)&amp;lt;/sb&amp;gt; is the variable used to display if the time is before or after 12:00 p.m.&lt;br /&gt;
* &amp;lt;sb&amp;gt;(time)&amp;lt;/sb&amp;gt; is the variable used to display the united time&lt;br /&gt;
&lt;br /&gt;
In the script below, for example, if you do not want to include &amp;quot;seconds&amp;quot; or any other time unit, the instances of it as well as related blocks must be removed:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
forever&lt;br /&gt;
if &amp;lt;&amp;lt;(current [hour v]) &amp;gt; (12)&amp;gt; or &amp;lt;(current [hour v]) = [0]&amp;gt;&amp;gt; then //if in the afternoon to midnight, or up to an hour past midnight&lt;br /&gt;
set [hour v] to ([abs v] of ((current [hour v]) - (12))) //the absolute value is needed in case the hour equals &amp;quot;0&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
set [hour v] to (current [hour v])&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;(current [minute v]) &amp;lt; (10)&amp;gt; then //if a single digit&lt;br /&gt;
set [minute v] to (join [0] (current [minute v]))&lt;br /&gt;
else&lt;br /&gt;
set [minute v] to (current [minute v])&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;(current [second v]) &amp;lt; (10)&amp;gt; then //if a single digit&lt;br /&gt;
set [second v] to (join [0] (current [second v]))&lt;br /&gt;
else&lt;br /&gt;
set [second v] to (current [second v])&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;(current [hour v]) &amp;lt; (12)&amp;gt; then //if before afternoon but after midnight&lt;br /&gt;
set [half v] to [a.m.]&lt;br /&gt;
else&lt;br /&gt;
set [half v] to [p.m.]&lt;br /&gt;
end&lt;br /&gt;
set [time v] to (join (join (join (join (join (join (hour) [:]) (minute)) [:]) (second)) [ ]) (half)) //there is a space after &amp;quot;second&amp;quot;&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[How to Create a Clock]]&lt;br /&gt;
* [[Current () (block)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;br /&gt;
[[ja:時刻を整形する]]&lt;/div&gt;</summary>
		<author><name>scratch&gt;CrazyBoy826</name></author>
	</entry>
</feed>