How do I get autoaticante the system time without the user Interact?
echo"<td>Fecha de Entrega <input type=date name=fecha_entrega size=10 value=\"".@$fecha_entrega."\"</td>";
How do I get autoaticante the system time without the user Interact?
echo"<td>Fecha de Entrega <input type=date name=fecha_entrega size=10 value=\"".@$fecha_entrega."\"</td>";
For that you need to set the time zone with date_default_timezone_set () , this way:
date_default_timezone_set('Australia/Melbourne');
$date = date('m/d/Y h:i:s a', time());
Here is the list of time zones
The point is that you want the time to be updated every second (I guess), showing it as a clock.
It would be best to do it on the client side, using the moment
library, in Javascript.
To present the names of days / months in Spanish, you can include the library moment-with-locale.js
You put this at the beginning and it will show you the names in Spanish:
moment.locale('es');
Let's see an example, using pure Javascript:
document.addEventListener("DOMContentLoaded", function(event) {
moment.locale('es');
var upDate = function() {
var elFecha = document.querySelector("#fecha");
var elHora = document.querySelector("#hora");
var nowDate = moment(new Date());
elHora.textContent = nowDate.format('HH:mm:ss');
elFecha.textContent =
nowDate.format('dddd DD [de] MMMM [de] YYYY ');
}
setInterval(upDate, 1000);
});
#fecha {
color: red;
}
<script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>
<div class="nowDateTime">
<p>
<span id="fecha"></span><br />
<span id="hora"></span>
</p>
</div>
The moment.js
library has more interesting possibilities and you can discover them on their website .