Assembles a dtl value with both date and time portions out of datetime components.
Parameters
Parameter | Type | Description |
---|---|---|
year (required) | int | The value that corresponds to the year portion of the date to be assembled. The valid range is 0000 - 9999, inclusive. |
month (required) | int | The value that corresponds to the month portion of the date to be assembled. |
day (required) | int | The value that corresponds to the day portion of the date to be assembled. |
hour (required) | int | The value that corresponds to the hour portion of the date to be assembled. |
minute (required) | int | The value that corresponds to the minute portion of the date to be assembled. |
second (required) | int | The value that corresponds to the second portion of the date to be assembled. |
Remarks
If any of the arguments are NULL
, the function returns
NULL
.
If the year
parameter is invalid, the function returns a random value which
may or may not be NULL
or a dtl
.
The year
parameter only accepts positive integers of up to four-digit, but
you can pass in 0
or even negative numbers as month
,
day
, hours
, minutes
, and
seconds
arguments. This is because the function uses the following base
date: year-input
-
1
),11
,30
, and adds the
month
, day
, hour
,
minute
, and second
arguments that you pass it to this base
date.
<form id='toDate' menuName='The todate() function' platforms='web' xmlns='http://schemas.mobilengine.com/fls/v1'> <declarations> <let id="datetime" shape="scalar" value='{TODATE(year.number
,month.number
,day.number
,hours.number
,minutes.number
,seconds.number
)}'/> </declarations> <numberbox id="year" label="Year" numberFormat='{decimalSeparator: "."}'/> <numberbox id="month" label="Month" numberFormat='{decimalSeparator: "."}'/> <numberbox id="day" label="Day" numberFormat='{decimalSeparator: "."}'/> <numberbox id="hours" label="Hours" numberFormat='{decimalSeparator: "."}'/> <numberbox id="minutes" label="Minutes" numberFormat='{decimalSeparator: "."}'/> <numberbox id="seconds" label="Seconds" numberFormat='{decimalSeparator: "."}'/> <textview label="The full date-time corresponding to the input above" text='{FORMATDTL(datetime, (dtf yyyy "-" MM "-" dd " " HH ":" mm ":" ss))}'/> <datepicker label="The result of the month and days arguments added to the base date" dateFormat='(dtf yyyy "-" MM "-" dd)' date='{datetime}'/> </form>
The month
argument affects the days
part of the date as
well: for each non-zero month
argument, the base date is reset to the last
day of the given month.
Figure 281. The todate() function adds the month and days arguments to the base date to calculate
the dtl
from the arguments
Negative arguments are valid for all date and time portions except for the year portion:
the function subtracts these from the base date shown above.
Sample
... <declarations> <let id="datetime" shape="scalar" value='{TODATE(year.number
,month.number
,day.number
,hours.number
,minutes.number
,seconds.number
)}'/> </declarations> <numberbox id="year" label="Year" numberFormat='{decimalSeparator: "."}'/> <numberbox id="month" label="Month" numberFormat='{decimalSeparator: "."}'/> <numberbox id="day" label="Day" numberFormat='{decimalSeparator: "."}'/> <numberbox id="hours" label="Hours" numberFormat='{decimalSeparator: "."}'/> <numberbox id="minutes" label="Minutes" numberFormat='{decimalSeparator: "."}'/> <numberbox id="seconds" label="Seconds" numberFormat='{decimalSeparator: "."}'/> <datepicker label="The date assembled from your input" dateFormat='(dtf yyyy "-" MM "-" dd)' date='{datetime}'/> ...
Figure 283. The value assigned to the datepicker
at the bottom of the screenshot
is the dtl
assembled from the input in the
numberbox
es