Is there a command to display number of seconds as hrs:min:seconds?

JB sundown at pacifier.com
Fri Oct 18 17:20:54 EDT 2019


Here is a terminal example;

on mouseUp
  put shell( "date" ) into tData
  answer question tData
end mouseUp

JB

> On Oct 18, 2019, at 11:12 AM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Let me throw my hat into the ring here...lol....I wrote this function to
> display time in a specific format
> 
> function TimeDisplay HowManySeconds
>   local final_output = "<d> days <hh>:<mm>:<ss>"
> 
>   local running_second_count
>   local next_calculation
> 
>   set itemdelimiter to "."  -- we are looking at boths sides of the
> decimal place
> 
>   // 86,400 seconds in an day
>   // 3600 in an hour
>   // 60 seonds in a minute
>   // replace counts as you go
> 
>   -- days
> 
>   put HowManySeconds / 86400 into next_calculation
> 
>   if next_calculation < 1 then
>      put HowManySeconds into running_second_count
>      replace "<d>" with "0" in final_output
>   else
>      // how many days?
>      replace "<d>" with  item 1 of next_calculation in final_output
>      put (HowManySeconds) - (item 1 of next_calculation * 86400) into
> running_second_count
>   end if
> 
>   -- hours
> 
>   put running_second_count / 3600 into next_calculation
> 
>   if next_calculation < 1 then
>      replace "<hh>" with "00" in final_output
>   else
>      // how many hours?
>      if the number of characters in item 1 of next_calculation = 1 then
>         replace "<hh>" with "0" & item 1 of next_calculation in
> final_output
>      else
>         replace "<hh>" with item 1 of next_calculation in final_output
>      end if
> 
>      put (running_second_count) - (item 1 of next_calculation * 3600) into
> running_second_count
>   end if
> 
> 
>   -- minutes
> 
>   put running_second_count / 60 into next_calculation
> 
>   if next_calculation < 1 then
>      replace "<mm>" with "00" in final_output
>   else
>      // how many minutes?
>      if the number of characters in item 1 of next_calculation = 1 then
>         replace "<mm>" with "0" & item 1 of next_calculation in
> final_output
>      else
>         replace "<mm>" with item 1 of next_calculation in final_output
>      end if
> 
>      put (running_second_count) - (item 1 of next_calculation * 60) into
> running_second_count
> 
>   end if
> 
>   -- seconds
> 
>   put running_second_count into next_calculation
> 
>      if next_calculation < 1 then
>      replace "<ss>" with "00" in final_output
>   else
>      // how many minutes?
>      if the number of characters in item 1 of next_calculation = 1 then
>         replace "<ss>" with "0" & next_calculation in final_output
>      else
>         replace "<ss>" with next_calculation in final_output
>      end if
>   end if
> 
>   return final_output
> end TimeDisplay
> 
> On Fri, Oct 18, 2019 at 11:55 AM Dar Scott Consulting via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> I would +1 a deltaTime format, but we might not agree on hours over 24 and
>> fractions of a second.
>> 
>>> On Oct 17, 2019, at 10:25 PM, Bill Vlahos via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> All great suggestions.
>>> 
>>> I mostly wanted to see if there already was such a function - which
>> there obviously isn’t.
>>> 
>>> But it is great to see several easy ways to built your own.
>>> 
>>> Thanks all.
>>> 
>>> Bill Vlahos
>>> 
>>> 
>>>> On Oct 17, 2019, at 8:51 AM, Bob Sneidar via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>>> 
>>>> The problem with one-liners is that the genius is implicit, not
>> explicit. ;-)
>>>> 
>>>> Bob S
>>>> 
>>>> 
>>>>> On Oct 17, 2019, at 08:44 , J. Landman Gay via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>>>> 
>>>>> Show-off. :-)
>>>>> --
>>>>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>>>> 
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> Office:226-706-9339
> Mobile:226-706-9793
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list