{
  "id": "military-time",
  "version": "dabf61626ba0",
  "status": "published",
  "name": "Military Time Calculator",
  "question": "What is it in military time?",
  "summary": "Converts between 12-hour a.m./p.m. time and military (24-hour) time, adds or subtracts hours and minutes, and finds the time between two military times.",
  "category": "days",
  "subcategory": "time-and-hours",
  "url": "https://www.acalculator.org/days/military-time-calculator",
  "markdown": "https://www.acalculator.org/days/military-time-calculator.md",
  "kind": "function",
  "method": "Military time = HHMM of the 24-hour clock; adding works in minutes after midnight, modulo 1,440, counting the days passed; an end time before the start is the next day.",
  "assumptions": [
    "Times are whole minutes. 0000 is midnight at the start of a day and 2400 midnight at its end; 2400 is accepted as an end time and when converting.",
    "12:00 a.m. is midnight and 12:00 p.m. is noon; the page adds the words, because NIST calls the a.m./p.m. labels ambiguous.",
    "No time zones or daylight saving time changes."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "mode": {
        "title": "I want to",
        "description": "Convert either way, add or subtract time, or find the time between two military times.",
        "type": "string",
        "enum": [
          "to-military",
          "to-standard",
          "add",
          "between"
        ]
      },
      "t": {
        "title": "Standard time",
        "description": "A clock time, such as 2:30 pm.",
        "type": "string",
        "pattern": "^\\d{2}:\\d{2}(:\\d{2})?$"
      },
      "m": {
        "title": "Military time",
        "description": "Four digits from 0000 to 2359, such as 0930 or 1745; a colon (17:45) is fine.",
        "type": "string",
        "maxLength": 5
      },
      "e": {
        "title": "End military time",
        "description": "The later time, 0000 to 2400; one before the start time is read as the next day.",
        "type": "string",
        "maxLength": 5
      },
      "h": {
        "title": "Hours to add",
        "description": "Whole hours; a negative number subtracts.",
        "type": "integer",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "min": {
        "title": "Minutes to add",
        "description": "Whole minutes; a negative number subtracts.",
        "type": "integer",
        "minimum": -60000000,
        "maximum": 60000000
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Answer",
      "description": "The military time, the standard time, or the time between, by mode.",
      "format": "text"
    },
    "military": {
      "label": "Military time",
      "description": "Four digits, no colon: 0000 to 2359 (2400 ends a day).",
      "format": "text"
    },
    "standard": {
      "label": "Standard time",
      "description": "The 12-hour clock with a.m. or p.m.",
      "format": "text"
    },
    "day": {
      "label": "Day",
      "description": "Which day the result falls on, from the start time’s day.",
      "format": "text"
    },
    "totalMinutes": {
      "label": "Total minutes",
      "description": "The time between, in minutes.",
      "format": "integer"
    },
    "decimalHours": {
      "label": "Decimal hours",
      "description": "The time between, in hours.",
      "format": "number"
    },
    "sentence": {
      "label": "In words",
      "description": "The answer as a sentence.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "mode": "to-military",
      "t": "14:30",
      "m": "1745",
      "e": "0215",
      "h": 8,
      "min": 30
    },
    "outputs": {
      "result": "1430",
      "military": "1430",
      "standard": "2:30 p.m.",
      "sentence": "2:30 p.m. is 1430 in military time."
    },
    "text": "2:30 p.m. is 1430 in military time."
  },
  "examples": [
    {
      "given": {
        "mode": "to-military",
        "t": "14:30"
      },
      "expect": {
        "result": "1430",
        "standard": "2:30 p.m."
      },
      "source": "Wikipedia, 24-hour clock, Military time (four digits with no separator, 0000 to 2359; 12:00 a.m. = 0000, 12:00 p.m. = 1200, 1:00 p.m. = 1300; midnight as 0000 or 2400), https://en.wikipedia.org/wiki/24-hour_clock (retrieved 2026-10-02); NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; in 24-hour notation 0000 is midnight at the start of a day and 2400 the end of it), https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "to-military",
        "t": "00:05"
      },
      "expect": {
        "result": "0005",
        "standard": "12:05 a.m."
      },
      "source": "NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; in 24-hour notation 0000 is midnight at the start of a day and 2400 the end of it), https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02); Python 3: datetime.time(0, 5).strftime('%H%M')"
    },
    {
      "given": {
        "mode": "to-standard",
        "m": "1200"
      },
      "expect": {
        "result": "12:00 p.m. (noon)"
      },
      "source": "NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; in 24-hour notation 0000 is midnight at the start of a day and 2400 the end of it), https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "to-standard",
        "m": "2400"
      },
      "expect": {
        "result": "12:00 a.m. (midnight, end of the day)",
        "military": "2400"
      },
      "source": "NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; in 24-hour notation 0000 is midnight at the start of a day and 2400 the end of it), https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "add",
        "m": "1745",
        "h": 8,
        "min": 30
      },
      "expect": {
        "result": "0215",
        "standard": "2:15 a.m.",
        "day": "the next day"
      },
      "source": "hand calculation in content.mdx: 17:45 + 8:30 = 26:15, minus 24:00 = 02:15 the next day; Python 3: datetime + timedelta; Wikipedia, 24-hour clock, Military time (four digits with no separator, 0000 to 2359; 12:00 a.m. = 0000, 12:00 p.m. = 1200, 1:00 p.m. = 1300; midnight as 0000 or 2400), https://en.wikipedia.org/wiki/24-hour_clock (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "add",
        "m": "0630",
        "h": -10,
        "min": 0
      },
      "expect": {
        "result": "2030",
        "day": "the day before"
      },
      "source": "hand calculation in content.mdx: 06:30 − 10:00 = −03:30, plus 24:00 = 20:30 the day before; Python 3: datetime − timedelta; Wikipedia, 24-hour clock, Military time (four digits with no separator, 0000 to 2359; 12:00 a.m. = 0000, 12:00 p.m. = 1200, 1:00 p.m. = 1300; midnight as 0000 or 2400), https://en.wikipedia.org/wiki/24-hour_clock (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "between",
        "m": "1745",
        "e": "0215"
      },
      "expect": {
        "result": "8 hours 30 minutes",
        "totalMinutes": 510,
        "decimalHours": 8.5
      },
      "source": "hand calculation in content.mdx: (24:00 − 17:45) + 02:15 = 6:15 + 2:15 = 8:30; Wikipedia, 24-hour clock, Military time (four digits with no separator, 0000 to 2359; 12:00 a.m. = 0000, 12:00 p.m. = 1200, 1:00 p.m. = 1300; midnight as 0000 or 2400), https://en.wikipedia.org/wiki/24-hour_clock (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "between",
        "m": "0000",
        "e": "2400"
      },
      "expect": {
        "result": "24 hours 0 minutes",
        "totalMinutes": 1440
      },
      "source": "NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; in 24-hour notation 0000 is midnight at the start of a day and 2400 the end of it), https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02)"
    }
  ],
  "sources": [
    "NIST, Times of Day FAQs (12 a.m. and 12 p.m. are ambiguous; 24-hour notation can use 0000 for midnight at the start of a day and 2400 for the end of a day). https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs (retrieved 2026-10-02)",
    "Wikipedia, 24-hour clock, Military time (four digits with no separator, 0000 to 2359; how 12-hour times convert; “hundred”, never “thousand”). https://en.wikipedia.org/wiki/24-hour_clock (retrieved 2026-10-02)"
  ],
  "related": [
    "time",
    "hours",
    "time-duration"
  ],
  "changelog": []
}
