Commit 248e6d69 authored by Susan Rati Lane's avatar Susan Rati Lane Committed by Jeffrey Schiller

Added instructions for combining DatePicker and TimePicker Instants

Also changed related anchor links to relative links

Change-Id: I6433975f0055a29a86843a1ba32e6c0f6a9513e8
parent 58ca9291
......@@ -538,15 +538,23 @@ none
<h2 id="Clock"> Clock </h2>
<img src="images/clock.png" alt="" />
<p>Non-visible component that provides the instant in time using the internal clock on the phone.It can fire a timer at regularly set intervals and perform time calculations, manipulations, and conversions.</p>
<p>Methods to convert an instant to text are also available. Acceptable patterns are empty string, MM/dd/YYYY HH:mm:ss a, or MMM d, yyyy HH:mm. The empty string will provide the default format, which is "MMM d, yyyy HH:mm:ss a" for FormatDateTime, "MMM d, yyyy" for FormatDate. To see all possible format, please see <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">here</a>. </p>
<p> Date and Time are formatted with InstantInTime and Duration. </p>
<p>Non-visible component that provides the instant in time using the internal clock on the phone. It can fire a timer at regularly set intervals and perform time calculations, manipulations, and conversions.</p>
<p>Operations on dates and times, such as from <a href="userinterface.html#DatePicker">DatePicker</a>
and <a href="userinterface.html#TimePicker">TimePicker</a>, are accomplished through methods in Clock.
Date and Time are represented as InstantInTime and Duration. </p>
<ul>
<li> <strong> Instant </strong> : consists of Year, Month, DayOfMonth, Hour, Minute, and Second.
<li> <strong>Instant</strong> : consists of Year, Month, DayOfMonth, Hour, Minute, and Second.
An instant can be created by using MakeInstant method. </li>
<li> <strong> Duration </strong> : time in milliseconds elapsed between instants. Duration can be
<li> <strong>Duration</strong> : time in milliseconds elapsed between instants. Duration can be
obtained by Duration method.</li>
</ul>
<p>Instants are assumed to be in the device's local time zone. When they are converted to or from milliseconds, the
milliseconds for a given Instance are calculated from January 1, 1970 in UTC (Greenwich Mean Time).</p>
<p>Methods to convert an Instant to text are also available. Acceptable patterns are empty string, MM/dd/YYYY HH:mm:ss a, or MMM d, yyyy HH:mm. The empty string will provide the default format, which is "MMM d, yyyy HH:mm:ss a" for FormatDateTime, "MMM d, yyyy" for FormatDate. To see all possible format, please see <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">here</a>. </p>
<p>A note on combining date and time: In order to combine the date from one Instant and the time from another, for
example from a DatePicker and TimePicker, extract the parts as text and use the text to create a new Instant.</p>
<p>Example: </p>
<img src="images/date_and_time_instant.png" alt="" />
<h3> Properties </h3>
<dl>
<dt> <code> TimerAlwaysFires </code> </dt>
......@@ -598,15 +606,15 @@ none
<dt> <code> text FormatDateTime(InstantInTime instant, text pattern) </code> </dt>
<dd> Returns text representing the date and time of an instant in the specified pattern</dd>
<dt> <code> text FormatTime(InstantInTime instant) </code> </dt>
<dd> Return text representing the time of an instant </dd>
<dd> Return text representing the time of an instant in the device's local time zone.</dd>
<dt> <code> number GetMillis(InstantInTime instant) </code> </dt>
<dd> Returns the instant in time measured as milliseconds since 1970. </dd>
<dd> Returns the instant in time measured as milliseconds since 1970 in UTC (Greenwich Mean Time). </dd>
<dt> <code> number Hour(InstantInTime instant) </code> </dt>
<dd> Returns the hour of the day(0-23) from the instant </dd>
<dt> <code> InstantInTime MakeInstant(text from) </code> </dt>
<dd> Returns an instant specified by MM/dd/YYYY hh:mm:ss or MM/dd/YYYY or hh:mm. An example text input is "06/22/2015 12:18"</dd>
<dt> <code> InstantInTime MakeInstantFromMillis(number millis) </code> </dt>
<dd> Returns an instant in time specified by the milliseconds since 1970. </dd>
<dd> Returns an instant in time specified by the milliseconds since 1970 in UTC. </dd>
<dt> <code> number Minute(InstantInTime instant) </code> </dt>
<dd> Returns the minute of the hour (0-59) from the instant </dd>
<dt> <code> number Month(InstantInTime instant) </code> </dt>
......
......@@ -565,6 +565,8 @@
<h2 id="DatePicker">DatePicker</h2>
<p>A button that, when clicked on, launches a popup dialog to allow the user to select a date.</p>
<p>Note: Date and time are manipulated using methods in the <a href="sensors.html#Clock">Clock</a>
component. </p>
<h3>Properties</h3>
<dl>
......@@ -587,7 +589,7 @@
<dt><code>Image</code></dt>
<dd>Image to display on button.</dd>
<dt><code>Instant</code></dt>
<dd>Instant of date. This instant can be used with <a href="http://ai2.appinventor.mit.edu/reference/components/sensors.html#Clock">Clock</a> component for date documentation, conversion, and matriculation.</dd>
<dd>Instant of date. This instant can be used with <a href="sensors.html#Clock">Clock</a> component for date documentation, conversion, and matriculation.</dd>
<dt><code><em>Month</em></code></dt>
<dd>the number of the Month that was last picked using the DatePicker. Note that months start in 1 = January, 12 = December.</dd>
<dt><code><em>MonthInText</em></code></dt>
......@@ -1275,6 +1277,8 @@ none
<h2 id="TimePicker">TimePicker</h2>
<p><p>A button that, when clicked on, launches a popup dialog to allow the user to select a time.</p></p>
<p>Note: Date and time are manipulated using methods in the <a href="sensors.html#Clock">Clock</a>
component. </p>
<h3>Properties</h3>
<dl>
......@@ -1297,7 +1301,7 @@ none
<dt><code>Image</code></dt>
<dd>Specifies the path of the button's image. If there is both an Image and a BackgroundColor, only the Image will be visible.</dd>
<dt><code>Instant</code></dt>
<dd>Instant of time. This instant can be used with <a href="http://ai2.appinventor.mit.edu/reference/components/sensors.html#Clock">Clock</a> component for time documentation, conversion, and matriculation.</dd>
<dd>Instant of time. This instant can be used with <a href="sensors.html#Clock">Clock</a> component for time documentation, conversion, and matriculation.</dd>
<dt><code><em>Minute</em></code></dt>
<dd>The minute of the last time set using the time picker</dd>
<dt><code>Shape</code> (designer only)</dt>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment