I got 3 numeric text fields which are days, hours and min. I have scripted in such a way that user can only type 2 digit for each field.
Can someone help me to combine this 3 fields into one integer (which is a UNIX time) so that I can save it in the database as a single column time.
HTML
<table><tr>
<td><input id='days' type='text' maxLength='2' placeholder='Days'></td>
<td><input id='hours' type='text' maxLength='2' placeholder='hours'></td>
<td><input id='min' type='text' maxLength='2' placeholder='Min'></td>
</tr></table>
JavaScript
var day = document.getElementById('days').value;
var hours = document.getElementById('hours').value;
var min = document.getElementById('min').value;
How do I combine this 3 variable (day,hours,min) into one single unix time variable and save it in the database. ( I know how to save it in the database but ? How do I combine the 3 variable and save it in a single JavaScript variable ? )
For this, I’m using you want to use the current month and year? You need to post the fields to your PHP script and use
strtotimeto formulate a timestamp:Or, using JavaScript: