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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -