The Date/Time point can be used to record a date and/or time to be stored in a session. The value of the date and time is determined using the device's local time settings. This point is highly customisable and provides options to change the way the value is formatted for display and also how it is formatted for storing the value in the session.
The Date/Time point can be configured in the Mobile Data Anywhere Designer to customise the formatting and and display options for the point. Below is an example of the properties window for a Date/Time point, opened in the Mobile Data Anywhere Designer.
The format settings allow you to customise how a Date/Time point will appear on screen and how the value is stored in the session. The appearance of the date on screen can be formatted by customising the Display setting. The value that is stored in the session can be formatted separately by customising the Output setting. A wide variety of formatting options are available for both the display and output settings and both options can be set independently.
These settings allow you to customise how the point functions when the point is used on a mobile device.
The Type option provides the following three options:
The Size of the point can be adjusted to either a set character size or to use the full width of the screen.
The Date/Time point can be configured to automatically set the point's value when the page is loaded by enabling the option to Set the current date/time when page is shown .
The option, Value cannot be changed once set , can be used to prevent the user from changing the value of the Date/Time point once the value has been set which can be important for time-critical projects.
The Date/Time point can be used in combination with the Math point to be used in calculations such as for time-based charges and other purposes. If a Date/Time point is included in a Math point's expression, the time and/or date will first be converted into a number. Where a date is included, this number will be the number of minutes since January 1st, 1979. If there is only a time, the number will be the number of minutes since midnight. When the Date/Time point includes seconds, they appear as a decimal portion of a minute in math operations (30 seconds is 0.5 minutes). Note, that when using date Maths and exporting to databases, it is best to use the universal YYYY-MM-DD date format. Dates presented in other formats may not be interpreted correctly. If other formats are used, the Regional setting on both the mobile device and host desktop PCs or server must be aligned with the date format chosen. This feature is demonstrated in Sample 2: Date/Time and Math Point .
The
Basic Points Sample
project contains examples of how to use many of the various points that are available. This project also contains a
page that demonstrates some of the ways that this point can be used in your projects.
In the provided sample project, basic_point_samples.ppc there is a page, Date Time Point , which contains two sections. The first section demonstrates a variety of ways that the Date/Time point can be customised. Open this project in the Mobile Data Anywhere Designer for a closer at how each point has been customised on each point's properties window.
This sample is provided in the sample project, basic_points_sample.ppc and can be seen on the Date Time Point page of the project. The sample demonstrates how a Date/Time point can be used in a Math point's expression to calculate the difference between two dates and two times.
Section two of the Date Time Point page shows how Date/Time points can be used with Math points in order to calculate the number of days between two dates.
The project contains a Math point called Days which is used to calculate the different, in days, between the two Date/Time points; FirstDate and SecondDate . The Math point has been configured with the following expression:
(SecondDate-FirstDate)/1440
The result of
(SecondDate-FirstDate)
will be in minutes and therefore needs to be divided by
1440
to convert the result into days.
Section three of the Date Time Point page shows how Date/Time points can be used with Math points in order to calculate the difference between two times, in minutes.
The project contains a Math point called Minutes which is used to calculate the difference, in minutes, between the two Date/Time points that have been configured to display and output time only; FirstTime and SecondTime . The Math point has been configured with the following expression:
SecondTime-FirstTime