Convert 24 hour clock with colon string to minutes with PHP? -



Convert 24 hour clock with colon string to minutes with PHP? -

using php, need convert string database 24 hr clock time colon.

examples:

00:30 01:15 03:59

should next integers represent minutes.

30 75 239

please, best way this?

thank in advance help.

one way split string:

function get_minutes($time_string) { $parts = explode(":", $time_string); $hours = intval($parts[0]); $minutes = intval($parts[1]); homecoming $hours * 60 + $minutes; }

for example:

print(get_minutes("3:20"));

prints 200.

php string time integer

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -