Initialize DateTime variable

Aggregate version: 2.0.5
Collect version: 1.28.1

Is there any way how to construct a DateTime object (variable) within a form from given string or number? There is the date() function allowing to convert integer representing a number of days since 1.1.1970 to a DateTime object ( but I did not find corresponding function for constructing a DateTime object including a time component.

I need to pre-set a value of a dateTime question based on previous calculations, namely retrieved from a QR code. Cold You advice me a correct way?

I'm getting the following error in the mobile application when I try the XML definition below (even when trying to convert just the date part):

Error evaluating field 'start-corrected' (/data/start-corrected[1]): The problem was located in Calculate expression for /data/start-corrected XPath evaluation: type mismatch The value "18169" can't be converted to date

I tried the following construction of the XML definition:

	<data id="_pouziti_auta_oprava" version="{{form_version}}">



	<bind nodeset="/data/predvyplnena_oprava" required="false()" type="barcode" />
	<bind calculate="regex(/data/predvyplnena_oprava, '\w*?\|\w*?\|.*')" nodeset="/data/predvyplnena_oprava_platna" required="false()" type="boolean" />
	<bind calculate="substring-before(/data/predvyplnena_oprava, '|')" nodeset="/data/predvyplnena_oprava_typ" required="false()" type="string" />
	<bind calculate="substring-after(/data/predvyplnena_oprava, '|')" nodeset="/data/predvyplnena_oprava_tmp" relevant="/data/predvyplnena_oprava_platna" required="false()" type="string" />
	<bind calculate="substring-before(/data/predvyplnena_oprava_tmp, '|')" nodeset="/data/predvyplnena_oprava_auto" relevant="/data/predvyplnena_oprava_platna" required="false()" type="string" />
	<bind calculate="substring-after(/data/predvyplnena_oprava_tmp, '|')" nodeset="/data/predvyplnena_oprava_cas" relevant="/data/predvyplnena_oprava_platna" required="false()" type="string" />

	<bind nodeset="/data/start-corrected" required="true()" type="dateTime" calculate="once(date(/data/predvyplnena_oprava_cas))"/>

Thanks Jan

Date, Times and DateTimes are stored as raw text strings in the XForm XML. So if you format your date string correctly in your default, or in your QR code, then it be should read it OK. Trying using the following format: yyyy-MM-dd'T'HH:mm:ss'Z', eg "2020-09-30T20:02:04Z"