Welcome Guest, Not a member yet? Register   Sign In
Getting current time in military time.
#1

[eluser]codelearn[/eluser]
Does anyone know how to get the current time in military time? Is there a PHP date function for that?

Thanks.
#2

[eluser]Michael Wales[/eluser]
Code:
<?= date('Hi'); ?>
#3

[eluser]codelearn[/eluser]
[quote author="walesmd" date="1188340014"]
Code:
<?= date('Hi'); ?>
[/quote]

Thank you, thank you!
#4

[eluser]codelearn[/eluser]
I can't seem to figure out if 12am is 0000 or 2400. No documentation on this is anywhere I can find.
#5

[eluser]Nicholas Helke[/eluser]
[quote author="codelearn" date="1188610551"]I can't seem to figure out if 12am is 0000 or 2400. No documentation on this is anywhere I can find.[/quote]

I believe in the military it is 0000.
#6

[eluser]codelearn[/eluser]
I believe so too, but PHP is only recognizing 2400. Can't think of a way to check.
#7

[eluser]Michael Wales[/eluser]
Midnight is 0000 (I'm in the military).

You could always do an if/statement on the returned value, to change it.
Code:
if ($time == '2400') {
  $time = '0000';
}




Theme © iAndrew 2016 - Forum software by © MyBB