Date & Time

The date and time Field stores a date and time. Internally, the stored value for all date/time Fields is a timestamp which equals the number of seconds elapsed from January 1, 1970 to the time specified. Outwardly, though, it appears as a calendar date and a time of the day. The display of this field is affected by Timezone and Locale settings.

How to Create

  1. Click the to add a field in your form.
  2. Choose “New Field”
  3. Select the table you wish to add the field to. Most of the time, this will be the current table you are on, called the current context.
  4. Select a field name and click “Choose Type”.
  5. Choose “Date and Time” from the list of field types.
  6. You can continue adding fields or click the “Select” button to finish adding.

Features

Field features can be edited by clicking on the orange field icon when the presentation layer is displayed.

Field Label

Grid Appearance

Tooltip

Field Format

Block Association

Default Value

Regionalization

Validation

Audit History

View Only

Field parts

The date and time Field has four interface parts but only one storage part.

Interface Parts

  • Date
  • Hour
  • Minute
  • AM/PM

Storage Part

  • Timestamp

Output formats

The address field has 25 different output formats. The following are examples of output when 09/09/2009 9:09 PM is stored in the date and time Field:

  • Full Field - 09/09/2009 09:09 PM
  • WX Stored Value - 1252544940 (The number of seconds from January 1, 1970
  • AM/PM Lowercase - pm
  • AM/PM Uppercase - PM
  • Day of the Month - 9
  • Day of the Month Suffix - th (For use in expressions such as 'The 9th of September, 2009')
  • Day of the Month With Leading Zero - 09
  • Day of the Week - Wednesday
  • Day of the Week Abbreviated - Wed
  • Day of the Week Number - 3 (The number that Wednesday takes as a day of the week, with Monday as 1)
  • Day of the Year - 252
  • Hour - 9
  • Hour 24 - 21
  • Hour 24 With Leading Zero - 21
  • Hour With Leading Zero - 09
  • Minute - 9
  • Month Name - September
  • Month Name Abbreviated - Sep
  • Month - 9
  • Month With Leading Zero - 09
  • Second - 0 (This return type is only useful when NOW() or a literal number is set to a Date and Time field through actions).
  • Timestamp - 1252544940 (Same as WX Stored Value)
  • Week of the Year - 37 (Returns the sequential number of the week that the time falls in) Expression Function - Week of the Year
  • Year 4 Digit - 2009
  • Year 2 Digit - 09

Acceptable inputs

Although a date and time Field is stored internally as a number, when interacting with the Field on a page, you must input a day and a time.

Setting the date is done by clicking on the date part of the Field and clicking on a day from the calendar flyout which will appear.

  • Navigating between months is done by using the <Prev and Next> links or by using the month drop-down for selecting the month explicitly.
  • The year can be selected by using the year drop-down.
  • The Today link in the midde of the top of the calendar flyout selects the current day.
  • The Clear link in the bottom left corner of the calendar flyout clears the currently selected day and closes the calendar flyout
  • The Close link in the bottom right corner closes the calendar flyout.
  • Clicking a day's symbol (Su, Mo, etc) near the top of the flyout reorganizes the calendar with that day as the first day of the week.

Setting the hour and minute are done by typing a number into the hour and minute Field Parts. There is no validation on these parts, though only two characters are allowed in each Field Part. Entering non-real times is allowed, though, and is handled by WorkXpress by adjusting the time by however many hours or minutes exceed 24 or 60, respectively. For example, if 12/31/1985 25:00 AM is entered and saved into a Date and Time field, WorkXpress would adjust the value to 01/01/1986 1:00 AM. Selecting AM or PM is done by using the AM/PM drop-down.

Setting With Actions

When setting the Date & Time field through actions, two different input formats may be used. As with other field types, the stored value from another Date & Time field may be used to save into a Date & Time field. Since the stored value for these fields is a timestamp, any timestamp value may also be used to save into a Date & Time field (may be calculated from an expression or extracted from a Date or Time field).

In addition to this, the text output of the Date & Time field (e.g. 04/23/1985 6:08 AM) may also be used to save into the Date & Time field. Because of this, you may also construct such a text string and use it to save into the Date & Time field. For instance, if I wanted to extract the date from a Date field and the Time from a Time field, combine them, and save the result in a Date & Time field, I could use the Displayed Value output for the Date field and the Displayed Value output for the Time field, and save it into a Date & Time field.

Ex. Suppose you have a Date field called Event Date and two time fields called Start Time and End Time on an item called Event and you needed to save two date & time fields called Start Date and Time and End Date and Time. To do this, set up actions to set the expression ${Event - Event Date} ${Event - Start Time} into the Start Date and Time field and the expression ${Event - Event Date} ${Event - End Time} into the End Date and Time field.

Filters

The date/time field can be filtered with the time-type filters.

Internationalization and Browser Settings

Date and Time settings should change automatically in non-US countries. For more information, read the Regionalization Field Settings page, or if you need to change your settings manually to simulate being in another country, try out these settings.

field type - date time.txt · Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2024