This code returns the current time, but I need it a minute ago.
<input type="text" value="<?php echo date("h:i:s A");?>">
Can you do that if the current time is 2pm; the input show me the 13:59?
This code returns the current time, but I need it a minute ago.
<input type="text" value="<?php echo date("h:i:s A");?>">
Can you do that if the current time is 2pm; the input show me the 13:59?
The second (optional) argument of the date()
function is a timestamp . So you can put the format as the first argument and as a second argument strtotime("-1 minute")
:
<input type="text" value="<?php echo date("h:i:s A", strtotime("- 1 minute"));?>">
You can use strtotime for it
$nuevafecha = strtotime ( '-1 minute' , strtotime ( date("h:i:s A")) ) ;
<input type="text" value="<?php echo $nuevafecha ;?>">
Calculated in the input directly
<input type="text" value="<?php echo strtotime ( '-1 minute' , strtotime ( date("h:i:s A")) );?>">