From my earlier post (How I can POST the value into input box?), one of the comment suggested me to do it in JQuery or Javascript.
More code and info, you can access it in the above link that I provided.
<label>Date</label>:  
<input style="font-size:22px" size="20" type="text" name="datetime" value="" placeholder="Click to get current time." required readonly>
<button style="font-size:1em" type="submit" name="Time" class="btn btn-info">
Click <i class="far fa-clock"></i>
</button>
After click at the button I expect that the value will be parsed into the input text box which I set it as readonly to prevent improper input from the user/admin.
click()event handler, and usingval()to update the value of your input