-1
Good morning guys, I need to find a way to fill in a field date and at the time of filling in it be inserted in another input, but in the American format, because I will use this field to make an Insert in a BD. I’ve started some kind of test,
var input = document.querySelector('input');
var div = document.querySelector('div');
input.addEventListener('keyup', function () {
div.innerHTML = input.value;
});
I know that so I type and it already prints elsewhere, but how to join the way . split?
What is the input format and what should be the output format?
– Woss
enters BR format and exits EN format for insert in the bank. EX. 29/08/2018 10:24 and exits 2018-08-29 10:24
– Bruno Rayol
dd/mm/yyyy hh:ii
foryyyy/mm/dd hh:ii
? And this value will be used in backend, you shouldn’t add it into a newinput
? The text within adiv
is not sent in the form submission.– Woss
dd/mm/yyyy hh:ii for yyyy/mm/dd hh:ii, that’s right, yes I’ll add in a new input. the example above is only to show the addeventlistener event
– Bruno Rayol
if you are using php as backend, then it is best to treat this date by php
– Tales Peres
Development is not in PHP.
– Bruno Rayol
my idea, would be to use a <input type="text" Hidden> to receive the date in the format I wish.
– Bruno Rayol
You can use the date type in the html input, which does the entire exchange process. Read here
– Henrique