Query results and creationDate

on my admin page, i’d created a query results on email match…to show user detail info stored in a dataset…
all is working except “_createdDate” system field that not works.

in database i can see item creation date as system field… named “_createdDate” but no readed from query.

thanks.

wixData.query("Utenti")
        .eq('company', azienda)
        .find()
        .then((results) => {
 if (results.items.length > 0) {
 let items = results.items[0]; // see below
 
                $w("#input1").placeholder = items['email'];
                $w("#input2").placeholder = items['nome'];
                $w("#input3").placeholder = items['cognome'];
                $w("#input4").placeholder = items['address'];
                $w("#input5").placeholder = items['city'];
                $w("#input6").placeholder = items['vat'];
                $w("#input7").placeholder = items['sdi'];
                $w("#input8").placeholder = items["_createdDate"];

The _createdDate field is a Data/Time field, so you will need to convert it to a string in order to display it in the input element.

BTW - you are setting the placeholder property of the input elements. Do you want to do that, or do you want to set the value property.

hi Yisrael, thanks for reply, yes im using placeholder property, i know that, field is readonly, just show text.
so… can you explain me how to convert date to text string according to my code?
thanks

Well, the simple way would be this:
$w(“#input8”).placeholder = items[“_createdDate”].toString();

If you need, you can format the date instead. Just do an Internet search and you’ll get 103,000,000 results for date formatting.

Also, if the field is read only, then you can just set the value instead of the placeholder. But it’s up to you.