AP Time Style

Format and validate AP-style clock time.

Description

Clock style rendering converts a supplied 24-hour time into a 12-hour string.

Clock style rendering converts a supplied 24-hour time into a 12-hour string. Zero minutes omit the colon and minute component.1

Format and validate AP-style clock time.

When to use AP Time Style

Use this tool to format and validate AP-style clock time.

Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.

How to use AP Time Style and understand its results

  1. Prepare the text, recorded observations, aligned figures or editorial criteria requested. Confirm what each label, count, timestamp or supplied flag represents before interpreting the result.
  2. Enter hour24, minute, renderedTime using the field table and calculation rules, then run the tool.
  3. Read expectedTime, matchesExpected. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
hour24Hour in 24-hour timeinteger; minimum: 0; maximum: 23Required
minuteMinuteinteger; minimum: 0; maximum: 59Required
renderedTimeRendered timestringRequired

Enter integer hour 0–23, minute 0–59 and rendering. Construct expected text and compare exactly after trimming the rendering. Midnight/noon are rendered as 12 a.m./12 p.m., rather than named words.

hour12=hour%12 or 12; period=hour<12 ? a.m. : p.m.

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
expectedTimeExpected AP-style timestring
matchesExpectedMatches expected timeboolean
json
{
  "input": {
    "hour24": 13,
    "minute": 5,
    "renderedTime": "1:05 p.m."
  },
  "output": {
    "expectedTime": "1:05 p.m.",
    "matchesExpected": true
  }
}

Limitations and assumptions

No date, time zone, daylight-saving conversion or broader style guide is applied.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.

Alternative or Complementary methods

Use Temperature Style: Validate a rendered temperature against supplied unit and degree-symbol policy. For a complementary task, use Dollar Figure Style: Validate dollar-figure grouping and decimal precision.

References

  1. AP Time Style — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies