The fmt_time() function

Use exibble to create a gt table. Keep only the date and time columns. Format the time column to have times formatted as hms_p (time style 3).

exibble |>
  dplyr::select(date, time) |>
  gt() |>
  fmt_time(
    columns = time,
    time_style = "h_m_s_p"
  )
date time
2015-01-15 1:35:00 PM
2015-02-15 2:40:00 PM
2015-03-15 3:45:00 PM
2015-04-15 4:50:00 PM
2015-05-15 5:55:00 PM
2015-06-15 NA
NA 7:10:00 PM
2015-08-15 8:20:00 PM

Use exibble to create a gt table. Keep only the date and time columns. Format the time column to have mixed time formats (times after 16:00 will be different than the others because of the expressions used in the rows argument).

exibble |>
  dplyr::select(date, time) |>
  gt() |>
  fmt_time(
    columns = time,
    rows = time > "16:00",
    time_style = "h_m_s_p"
  ) |>
  fmt_time(
    columns = time,
    rows = time <= "16:00",
    time_style = "h_m_p"
  )
date time
2015-01-15 1:35 PM
2015-02-15 2:40 PM
2015-03-15 3:45 PM
2015-04-15 4:50:00 PM
2015-05-15 5:55:00 PM
2015-06-15 NA
NA 7:10:00 PM
2015-08-15 8:20:00 PM

Use exibble to create another gt table, this time only with the time column. Format the time column to use the "EBhms" time style (which is one of the ‘flexible’ styles). Also, set the locale to "sv" to get the dates in Swedish.

exibble |>
  dplyr::select(time) |>
  gt() |>
  fmt_time(
    columns = time,
    time_style = "EBhms",
    locale = "sv"
  )
time
tors 1:35:00 på efterm.
tors 2:40:00 på efterm.
tors 3:45:00 på efterm.
tors 4:50:00 på efterm.
tors 5:55:00 på efterm.
NA
tors 7:10:00 på kvällen
tors 8:20:00 på kvällen