Time in Words

mrigyamrigya Member Posts: 124
Hi All,

how can we convert Time into words like in decimal values
example:
19:00:00 into Ninteen Hours only.

Regards
Mrigya

Answers

  • matttraxmatttrax Member Posts: 2,309
    With a lot of IF statements or CASE statements.

    hours := FORMAT(TimeVariable, 0, '<Hours24>');
    CASE hours OF
    1: hoursText := 'One'
    2: hoursText := 'Two'


    And on down the line. Repeat for minutes and seconds. Combine your text at the end.
  • DaveTDaveT Member Posts: 1,039
    Hi Mrigya,

    Have a look at the check printing report which converts the value to a text string with the value in words.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • kinekine Member Posts: 12,562
    You can use Duration datatype to display "time" (which means duration) in form "5 hours 32 minutes 45 secods 5 milliseconds"... just try e.g.
    DurationVariable := TimeVariable-0000T;
    Message('%1 = %2',TimeVariable, DurationVariable);
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DaveTDaveT Member Posts: 1,039
    kine wrote:
    You can use Duration datatype to display "time" (which means duration) in form "5 hours 32 minutes 45 secods 5 milliseconds"... just try e.g.
    DurationVariable := TimeVariable-0000T;
    Message('%1 = %2',TimeVariable, DurationVariable);
    
    8) - Nice thinking :mrgreen:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • mrigyamrigya Member Posts: 124
    Thanks a ton everyone...its solved
  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,499
    [The use of [SOLVED] in the Topic Title is no longer supported. Please edit the first message in the thread and use the field Attribute (below the Subject-field) to put a green checkmark next to the Topic Title. And please remove the [Solved] in your Subject.]
Sign In or Register to comment.