i need a simple script to print the current minutes. but ONLY the minutes(or seconds ^^). in php
$min = $interval ->days * 24 * 60; $min += $interval ->h * 60; $min += $interval ->i; // Printing the Result in Minutes format.
print date('H:i'); $var = date('H:i'); Should do it, for the current time. Use a lower case h for 12 hour clock instead of 24 hour. More date time formats listed here.
Definition and Usage The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
Use date_diff() Function to Get Time Difference in Minutes in PHP. We will use the built-in function date_diff() to get time difference in minutes. For this, we need a start date and an end date. We will calculate their time difference in minutes using the date_diff() function.
use date('i')
to show minutes or date('s')
for seconds.
http://php.net/manual/en/function.date.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With