Store Time in the database

Asked

Viewed 74 times

2

I’m having problems need to store the value of two time values and minutes in the database.

Here is the input and the jQuery

<input type="time" name="txthoraentrada" id="txthoraentrada"class="form-control" required>
var hrentrd = $('#txthoraentrada').val();

Remarks:

  • I tried to use val('HH:mm'), but does not save the values in the database and displays a Warning that is out of standard, even though this is one of the standards that the Warning speech is valid.
  • I tried using the plugin timepicker. Didn’t work out :(
  • I’m using jQuery, AJAX and PHP.
  • The field is of the type time in the database
  • Is recording 00:00:00 on the bench. I appreciate any help.

2 answers

-2

Good night Diego_f.

It was not clear. Can jQuery send the information to the backend? If yes, and the problem is to write to the database, then try to save your data in string format, because the field 'TEAM' accepts numeric type and string type.

Ex.: 'HH:MM:SS'

  • When use val('HH:mm:ss') does not send. And when use only val() saves as 00:00:00 regardless of the value I place.

  • I solved the problem, it was my php file that was incorrect.

  • @Diego_f send your solution as a response and then accept it as the correct answer so that if someone else has this problem can solve and the question can be closed in the forum.

-6

A time field in the database saved in this format: 00:00:00 and the input time field is sending the data in this form 00:00, if changing the field type in the database to scan will probably save

Browser other questions tagged

You are not signed in. Login or sign up in order to post.