3
I need javascript to fill automatically in a <input type="hidden" />
with the current date, and another 15 days after the current date.
It will be used for the date of issue of one ticket and the other for the due date of the ticket, and need the format aaaammdd
.
<input name="dataEmissao" type="hidden" />
<script>
????????????????
</script>
and
<input name="dataVencimentoTit" type="hidden" />
<script>
????????????????
</script>
Note: can’t be PHP, because I’m using this code inside a code Theme block, in Wordpress. Inside does not work PHP code, only Javascript.
What format do you want to give the date? yyyymmdd?
– Sergio
The winning should be done on the side that generates billet, and not form. In fact, if it is hosted wordpress, could yes do with PHP, and usually is not the theme the best place for it.
– Bacco
Sicoob sent me an example that the due field is sent via post. I also do not agree, but require the completion of this input. :/
– Rafael T
@Rafaelt check here:https://jsfiddle.net/74Ly8gbx/ is what you’re looking for?
– Sergio
So... is that I need to put this code in a specific location within the theme... I don’t know why is not interpreting php in it...
– Rafael T
the formed must be yyyymmdd
– Rafael T
@Rafaelt worse than even google does such things in the name of "standard". Even so, if you could generate for PHP it would be better. However, in JS it is not complicated. Let’s wait for answer.
– Bacco
It worked... only the format that came like this "Mon Jun 13 2016 12:52:12 GMT-0300 (Official Time of Brazil)"
– Rafael T
@Sergio, only the yyymmdd format is missing. Thank you so much for now!!!
– Rafael T
@Rafaelt joined an answer with this. Load the page again...
– Sergio
@Sergio Something went wrong... the result for the current date was "2016413".. I also need the month to have two digits.. the right one would be "20160613"
– Rafael T
@Rafaelt you’re right, https://jsfiddle.net/3zymmpxb/1/
– Sergio
@Sergio Perfeito! Thank you very much!!!!
– Rafael T
@Sergio Amigo, abusing... I need to reduce the time to 10 days. You sent 1296e6 for 15 days... I do not know how to do this account... can you pass the new value to 10 days please? Thanks again!
– Rafael T
@Rafaelt just count from milliseconds.
10(dias) x 24(h) x 60(m) x 60(s) x 1000
, that is to say:864000000
which may be shortened864e6
.– Sergio
@Sergio thank you so much again. Hug
– Rafael T