I set a variable ‘today’ with the function “Date and time” - interval minutes.
I entered the value in a form, creating a hidden field.
When I save the values in the database, the date is set to one month back.
2021-04-30 instead 2021-05-30
2021-05-01 instead 2021-05-31
I also tried to flag “UTC Time” but without change
Is the date setup correctly on your server?
Yes, it is.
I don’t understand why the date I see on the page form is correct, and when I write it in the database it gives me the problem. Shouldn’t it just save the value that’s on the page?
The first thing I always think of when date/time is not correctly stored is checking id date/time is set correctly on the server and what timezone is being used. Invalid timezone can not cause a difference of 30 days. What kind of database and field type are you storing the date in?
Can you post your form code and Server Action steps?
<form method="post" dmx-generator="bootstrap4" dmx-form-type="horizontal" id="form1" is="dmx-serverconnect-form" action="dmxConnect/api/admin/admin-pratica-crea1.aspx"
dmx-on:success="sc_pratica_storico1.load();sc_pratica_storico2.load();sc_datiazienda.load({});notifies1.success('Operazione completata')">
<div class="form-group row">
<div class="col-sm-10">
<input type="hidden" class="form-control" id="inp_codazienda" name="codazienda" dmx-bind:value="'IDS'+sc_praticaconta.data.custom[0].newazienda" aria-describedby="inp_codazienda_help"
placeholder="Enter Codazienda">
<input type="hidden" class="form-control" id="inp_anagrafica_id" name="anagrafica_id" dmx-bind:value="query.anagrafica_id" aria-describedby="inp_anagrafica_id_help">
<input type="hidden" class="form-control" id="inp_stato0" name="stato0" dmx-bind:value="1" aria-describedby="inp_stato0_help" placeholder="Enter Stato0">
<input class="form-control" id="inp_datastato0" name="datastato0" aria-describedby="inp_datastato0_help" dmx-bind:value="oggi.datetime.toISODate()" type="hidden">
<input type="hidden" class="form-control" id="inp_stato1" name="stato1" dmx-bind:value="1" aria-describedby="inp_stato1_help" placeholder="Enter Stato1">
<input class="form-control" id="inp_datastato1" name="datastato1" aria-describedby="inp_datastato1_help" dmx-bind:value="oggi.datetime.toISODate()" type="hidden">
</div>
</div>
<div class="form-group row">
<div class="col-sm-10 text-left">
<button type="submit" class="btn btn-primary">Accetta la Pratica e crea progressivo</button>
</div>
</div>
</form>
I’ve also tried without “ISO CONVERT”
For the hidden field try dmx-bind:value="oggi.datetime.formatDate('yyyy-MM-dd')"
just to see if it’s the ISO conversion causing the problem
So can you please answer:
Also ,when posting code follow this guide and don't wrap it in 3 dots, wrap it in 3 backticks:
```
The problem is with “View/Edit data” in Wappler.
Look at this: same record, view in SQL Management Studio e with Wappler doing “Fetch Data”.
So the problem is only how the date is displayed in the Database Manager?
It is stored correctly in your DB?
Yes, it’s stored correctly