Can't insert a start time and end time into mysql fields

Trying to store data fields for a timesheet application. How can I convert a text field in a form with date and time in it correctly formatted for a mysql date or time field? I get a server error and the field won’t load. If I set the form text field as a date, it doesn’t work either. However, when I use just a date, not date and time, I can insert that into a mysql database.

I also can’t seem to figure out how to use the time picker. I can select the time but it doesn’t actually store anything into the field using it. There is no apply or similar button. I don’t know why I’m just going nuts trying to figure this out. I’m sure it’s simple and I’m just have a senior moment. Any help appreciated.

Thanks,
Rick

no Wappler experience here, but
do you know for sure the format that MySql is expecting?
have you seen the raw data in mysqlworkbench?
… or seen a working INSERT statement?

I’m new, so i don’t know enough about the middleware thats generating the INSERT, but the time format can include timezone offset, or not depending on the database type (I’m a MS SQL guy myself).
‘19-Mar-2022T23:00:00-4:00’ is diff. than
‘19-Mar-2022 23:00:00’

I don’t know yet whose responsibility it is in the framework to match the data format.
Have you checked the Chrome inspector to look at the POST to see whats being sent?
I’m only replying in case this helps a tiny bit tonight - am sure someone will reply soon that knows the exact answer.
Jaymer…

Hi.
Can you please share the error you are getting on the SA?
Most likely its just a simple formatting issue.

I get a status code 500 in the developer tools when I turn on the debug. I can see the payload as the form with the correct looking data. It doesn’t seem to matter whether I have the mysql fields at date, time , datetime, or text. The form fields are text but formatted to the date yyyy-MM-dd HH:mm:ss. When I take those fields off, the form submits fine so its the date fields which cause the problem.

Dates are often submitted/processed with the time zone on the end (in many cases Z) which MySQL doesn’t like. You can use a formatter to correct:

.formatDate('yyyy-MM-dd HH:mm:ss') or use .replace.('Z','') on the date value being inserted

So what is the exact error you see - that is the most important part of this 500 message.

That’s what I was going to ask. @marsalstudios
See the response tab inside the Network tab of dev tools. It will show more details about the error.

it just says server error.
I was able to work around the problem but never figured it out.

Then you need to enable debug mode in Server Action Panel’s settings.

Rick, as it’s always been in such situations, please follow