4.3 Date and Time
Input type
The element types Date, Time and Date and Time are generally open fields where the users can click to set the date or time themselves, through calendar, date or time pop-ups or text fields. The elements can also be set to automatically show the present date and time – which can then be changed by the user.
Autocapture
To autocapture e.g. time or date when opening a form or a subform (repeat) you can select Capture value automatically under Element Properties – Element Type.
Formatting
Zegeba uses moment.js date and time as described under General Formatting below.
Default data and time formatting uses the settings of the device or the browser used. You can override the standard settings by using a date/time formatting string.
The example below shows various parameters for customizing the look and functionality of the Date and Time input.
This element automatically shows the placeholder texts we have entered: “No date given” and “No time given”:
When the update button to the right is pressed, the date will be shown as DD.MM.YYYY and the time as HH:mm in 30-minute intervals (rounded down to the 30 minutes just passed):
The user can press this date to get a calendar to choose a date from and a text field to type a different time in.
From Zegeba v 4.4, there is a new option for dates: Date view mode. Normally when you click on a date, the calendar will open up as shown in the picture above, where you can scroll horizontally through the months. The Date view mode can be set to either days, months, years or decades, to make it easier to find dates that are way back or ahead in time. With the Decades view mode, the date element will open like below, where it is much easier to find for instance a date of birth decades ago.
Note: If you need to calculate the time interval between starting and stopping an activity, you must define it in the Calculations Editor as start_time – stop_time (with the start time first and a minus in between).
General formatting
Original source: momentjs.com
ELEMENT | FORMAT | DESCRIPTION |
---|---|---|
Month | M Mo MM MMM MMMM |
1 2 … 11 12 1st 2nd … 11th 12th 01 02 … 11 12 Jan Feb … Nov Dec January February … November December |
Quarter | Q Qo |
1 2 3 4 1st 2nd 3rd 4th |
Day of Month | D Do DD |
1 2 … 30 31 1st 2nd … 30th 31st 01 02 … 30 31 |
Day of Year | DDD DDDo DDDD |
1 2 … 365 366 1st 2nd … 365th 366th 001 002 … 365 366 |
<strong>Day of Week | d do dd ddd dddd |
0 1 … 5 6 0th 1st … 5th 6th Su Mo … Fr Sa Sun Mon … Fri Sat Sunday Monday … Friday Saturday |
Day of Week (Locale) | e | 0 1 … 5 6 |
Day of Week (ISO) | E | 1 2 … 6 7 |
Week of Year | w wo ww |
1 2 … 52 53 1st 2nd … 52nd 53rd 01 02 … 52 53 Note: These week numbers starts at the week day of Jan 1st. |
Week of Year (ISO) | W Wo WW |
1 2 … 52 53 1st 2nd … 52nd 53rd 01 02 … 52 53 Note: This is the standard week number, beginning at Monday the week of Jan 1st. |
Year | YY YYYY Y |
00 01 … 98 99 2000 2001 … 2098 2099 2000 2001 … 9999 +10000 +10001 Note: This complies with the ISO 8601 standard for dates past the year 9999 |
Week Year | gg gggg |
00 01 … 98 99 2000 2001 … 2098 2099 |
Week Year (ISO) | GG GGGG |
00 01 … 98 99 2000 2001 … 2098 2099 |
AM/PM | A a |
AM PM am pm |
Hour | H HH h hh k kk |
0 1 … 22 23 00 01 … 22 23 1 2 … 11 12 01 02 … 11 12 1 2 … 23 24 01 02 … 23 24 |
Minute | m mm |
0 1 … 58 59 00 01 … 58 59 |
Second | s ss |
0 1 … 58 59 00 01 … 58 59 |
Fractional Second | S SS SSS SSSS … SSSSSSSSS |
0 1 … 8 9 00 01 … 98 99 000 001 … 998 999 000[0…] 001[0…] … 998[0…] 999[0…] |
Time zone | z or zz Z ZZ |
CET EST … MST PST -07:00 -06:00 … +06:00 +07:00 -0700 -0600 … +0600 +0700 |
Unix Timestamp | X | ###### |
Unix Millisecond Timestamp | X | ###### |