Updated Tutorial Available
This tutorial is for the Desktop Designer. To view the updated tutorial for the online project designer, please click here .

Date Time Point

Learn how the Date Time point can be used and see it in action with the sample projects.

What is the Date Time point?

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.

Key Features

  • Provides a fundamental tool for recording dates and times.
  • Provides a large number of pre-set formatting options to format the displayed and stored value of the point.
  • Can be used in Math point calculations by converting Date/Time point value to a numeric value.
  • Configurable to be set automatically, when the page of the session is loaded.
  • Configurable to prevent changes once the date/time has been set for time-critical applications such as timesheets.

Date time point animation

Configuration and Settings

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.


Date time point properties

Format Settings

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.

Options

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:

  • Tap to set the current date/time
    The Date/Time point will be set to the device's local time when the point is tapped.
  • Touch-friendly control
    The Date/Time point will display a date/time picker allowing the user to choose the date and time, when the point is tapped.
  • Native Windows date/time control (Windows Mobile only)
    The Date/Time point will appear as a caption followed by a check box and date/time string. Tapping the check box will record the current time and/or date. Arrow controls allow the user to select the date and time manually.

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.

Calculations using a Date/Time point

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 .


Sample Projects

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.


Sample Projects
You can download the sample project for this tutorial or import the projects directly into your account.

Sample 1: Date/Time Formats

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.

Date time point formats

Sample 2: Calculations using Date/Time and Math points

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.

Date time and math point calculation

Calculating difference between two dates

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.

Calculating difference between two times

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