How to get Hours, Minutes or seconds from Time Data Type in Business Central | AL Code | NAV

 Format Time Data Type To Hours, Minutes or Seconds

So we have Time suppose System Current Time in Time data type as follows and what we need is to get only hours minute or seconds out of the Time value that is formatting it into some text expression like.
                                          22 hours 34 minutes 5 seconds 
or whatever you are getting in other planets but i have same solution for you aliens.👽 

 var

                 MySysTime: Time;
begin
MySysTime := Time;
Message('Regular Time printing as : %1', MySysTime );

//Formatting into parts separtely
                  
message('Current hours %1', Format(MySysTime , 0, '<Hours24,2>'));
message('Current minutes %1', Format(MySysTime , 0, '<Minutes,2>')); message('Current seconds %1', Format(MySysTime , 0, '<seconds,2>'));

end;

Comments

Popular posts from this blog

Reading json data in Business Central

Consume Rest API in Business Central Code with Basic Auth

How To do Hashing HMAC RSA 1 algorithm or cryptography in Microsoft Business Central | AL Code