Function Spellings Class

SpellTime

Spell the hour and minute components of a date-time value using English words.

Signature (Visual Basic / VBA)

Public Function SpellTime( _
      Optional ByVal vDateTime As Variant _
    , Optional ByVal vLimitMins As Variant _
    , Optional ByVal vIncludeAMPM As Variant _
    ) As Variant

Code Example

    SpellTime(#12:01:23#, 10) = "One Past Noon"
    SpellTime(#12:15:23#, 10) = "Twelve Fifteen"
    SpellTime(#10:58:23#, 10) = "Two 'til Eleven"
    SpellTime(#10:58:23#, 20) = "Quarter Past Ten"
    SpellTime(#10:30:23#, 30) = "Half Past Ten"
    SpellTime(#22:30:23#, 30, True) = "Half Past Ten P.M."
    SpellTime(#22:30:23#, 10, False) = "Ten Thirty"

Parameters

Parameter Description
vDateTime Date-time value whose time component will be spelled using English words. vDateTime defaults to Now (the current time) if it is missing or Null or cannot be fixed up to a Date.
vLimitMins The maximum number of minutes before and after each hour for which the function will describe the time as "Minutes Past Hour" or "Minutes 'til Hour" instead of the more normal "Hour Minute". vLimitMins defaults to 10 (ten) if it is missing or Null or cannot be fixed up to a number.
vIncludeAMPM True if the "A.M." or "P.M." indicator should be added to the end of the result string. vIncludeAMPM defaults to False (the A.M./P.M. indicator will not be added) if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Note Function does support pre-1900 date/times.
Note The time portion of vDateTime is rounded to the nearest minute using the Visual Basic CInt function.