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

2019-10-18 Thread Stephen Barncard via use-livecode
(Ice cream cone hits forehead)
--
Stephen Barncard - Sebastopol Ca. USA -
mixstream.org


On Fri, Oct 18, 2019 at 2:24 PM JB via use-livecode <
use-livecode@lists.runrev.com> wrote:

> 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@lists.runrev.com> wrote:
> >
> > Let me throw my hat into the ring here...lolI wrote this function to
> > display time in a specific format
> >
> > function TimeDisplay HowManySeconds
> >   local final_output = " days ::"
> >
> >   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 "" with "0" in final_output
> >   else
> >  // how many days?
> >  replace "" 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 "" with "00" in final_output
> >   else
> >  // how many hours?
> >  if the number of characters in item 1 of next_calculation = 1 then
> > replace "" with "0" & item 1 of next_calculation in
> > final_output
> >  else
> > replace "" 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 "" with "00" in final_output
> >   else
> >  // how many minutes?
> >  if the number of characters in item 1 of next_calculation = 1 then
> > replace "" with "0" & item 1 of next_calculation in
> > final_output
> >  else
> > replace "" 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 "" with "00" in final_output
> >   else
> >  // how many minutes?
> >  if the number of characters in item 1 of next_calculation = 1 then
> > replace "" with "0" & next_calculation in final_output
> >  else
> > replace "" 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@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@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@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@lists.runrev.com> wrote:
> >
> > Show-off. :-)
> > --
> > Jacqueline Landman Gay | jac...@hyperactivesw.com
> 
> 
>  ___
>  use-livecode mailing list
>  use-livecode@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@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@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>

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

2019-10-18 Thread JB via use-livecode
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 
>  wrote:
> 
> Let me throw my hat into the ring here...lolI wrote this function to
> display time in a specific format
> 
> function TimeDisplay HowManySeconds
>   local final_output = " days ::"
> 
>   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 "" with "0" in final_output
>   else
>  // how many days?
>  replace "" 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 "" with "00" in final_output
>   else
>  // how many hours?
>  if the number of characters in item 1 of next_calculation = 1 then
> replace "" with "0" & item 1 of next_calculation in
> final_output
>  else
> replace "" 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 "" with "00" in final_output
>   else
>  // how many minutes?
>  if the number of characters in item 1 of next_calculation = 1 then
> replace "" with "0" & item 1 of next_calculation in
> final_output
>  else
> replace "" 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 "" with "00" in final_output
>   else
>  // how many minutes?
>  if the number of characters in item 1 of next_calculation = 1 then
> replace "" with "0" & next_calculation in final_output
>  else
> replace "" 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@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@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@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@lists.runrev.com> wrote:
> 
> Show-off. :-)
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com
 
 
 ___
 use-livecode mailing list
 use-livecode@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@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@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@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@lists.runrev.com

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

2019-10-18 Thread Tom Glod via use-livecode
Let me throw my hat into the ring here...lolI wrote this function to
display time in a specific format

function TimeDisplay HowManySeconds
   local final_output = " days ::"

   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 "" with "0" in final_output
   else
  // how many days?
  replace "" 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 "" with "00" in final_output
   else
  // how many hours?
  if the number of characters in item 1 of next_calculation = 1 then
 replace "" with "0" & item 1 of next_calculation in
final_output
  else
 replace "" 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 "" with "00" in final_output
   else
  // how many minutes?
  if the number of characters in item 1 of next_calculation = 1 then
 replace "" with "0" & item 1 of next_calculation in
final_output
  else
 replace "" 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 "" with "00" in final_output
   else
  // how many minutes?
  if the number of characters in item 1 of next_calculation = 1 then
 replace "" with "0" & next_calculation in final_output
  else
 replace "" 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@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@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@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@lists.runrev.com> wrote:
> >>>
> >>> Show-off. :-)
> >>> --
> >>> Jacqueline Landman Gay | jac...@hyperactivesw.com
> >>
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-18 Thread Dar Scott Consulting via use-livecode
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 
>  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 
>>  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 
>>>  wrote:
>>> 
>>> Show-off. :-)
>>> --
>>> Jacqueline Landman Gay | jac...@hyperactivesw.com
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Bill Vlahos via use-livecode
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 
>  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 
>>  wrote:
>> 
>> Show-off. :-)
>> --
>> Jacqueline Landman Gay | jac...@hyperactivesw.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Bob Sneidar via use-livecode
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 
>  wrote:
> 
> Show-off. :-)
> --
> Jacqueline Landman Gay | jac...@hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread J. Landman Gay via use-livecode

Show-off. :-)
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On October 17, 2019 5:22:44 AM Mark Waddingham via use-livecode 
 wrote:



On 2019-10-17 10:50, Klaus major-k via use-livecode wrote:

save some lines by setting the numberformat first (lazy moi :-)

...



Save even more lines by using format, div and mod...

function formatRemainingTime pSeconds
  return format("%02d:%02d:%02d", pSeconds div 3600, (pSeconds mod 3600)
div 60, pSeconds mod 60)
end formatRemainingTime

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Bob Sneidar via use-livecode
I call it sqltime because it has to be formatted as hh:mm:ss. 

function formatTime theTime, theFormat
   /*
   accepts any valid time and returns the form of the time specified in the 
second parameter.
   The valid formats are:
   sql time: hh:mm:ss (Note: combining sql date from the formatDate() function 
with the
   sql time will produce a valid SQL date time type). 
   short time: LC short time format
   abbreviated time: LC abbr time format (same as short time)
   long time: LC long time format
   seconds: the number of seconds since the prior midnight
   military: the military time 00:00 - 23:59
   */
   if theTime is empty then return empty
   
   set the numberformat to "00"
   switch theFormat
  case "sql time"
 convert theTime to dateitems
 put (item 4 of theTime +0) & ":" & \
   (item 5 of theTime +0) & ":" & \
   (item 6 of theTime +0) into theTime
 break
  case "short time"
 convert theTime to short time
 break
  case "abbreviated time"
 convert theTime to abbreviated time
 break
  case "long time"
 convert theTime to long time
 break
  case "seconds"
 convert theTime to seconds
 break
  case "military"
 set the itemdelimiter to ":"
 
 if theTime contains "PM" then
add 12 to item 1 of theTime
 end if
 
 put word 1 of item 2 of theTime into item 2 of theTime
 break
   end switch
   
   return theTime
end formatTime


> On Oct 16, 2019, at 17:23 , Bill Vlahos via use-livecode 
>  wrote:
> 
> I’m writing a countdown timer application and want to display the remaining 
> time not as the number of seconds but in the format of HR:MIN:SEC left.
> 
> For example 75 seconds would display as “0:1:15”.
> 130 seconds would display as “0:2:10”.
> 
> I know how to do the math to figure it out but I’m wondering if there is a 
> built in function to do this.
> 
> Convert wants to deal with actual time so I would get something like “0:1:15 
> PM”.
> 
> Thanks,
> Bill Vlahos
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread hh via use-livecode
Save a lot of lines by using "format":

on countdown t
  put format("%02d:%02d:%02d",t div 3600,(t mod 3600) div 60,t mod 60) into fld 
1
  subtract 1 from t
  if t < 0 then exit countDown
  send "countdown t" to me in (1000-the millisecs mod 1000) millisecs
end countdown

> > Terry J. wrote:
> > Not built-in but...
> > 
> > function formatRemainingTime pTime
> >   put trunc(pTime/3600) into tHours
> >   put pTime mod 3600 into tTimeX
> >   put trunc(tTimeX/60) into tMins
> >   put tTimeX mod 60 into tSecs
> >   if tHours < 10 then put "0" before tHours
> >   if tMins < 10 then put "0" before tMins
> >   if tSecs < 10 then put "0" before tSecs
> >   return tHours&":"&":"
> > end formatRemainingTime
> 
> Klaus M. wrote:
> save some lines by setting the numberformat first (lazy moi :-)
> 
> function formatRemainingTime pTime
>set the numberformat to "xx"
>put trunc(pTime/3600) into tHours
>put pTime mod 3600 into tTimeX
>put trunc(tTimeX/60) into tMins
>put tTimeX mod 60 into tSecs
>return tHours&":"&":"
> end formatRemainingTime



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Klaus major-k via use-livecode
Hi Mark,

> Am 17.10.2019 um 12:21 schrieb Mark Waddingham via use-livecode 
> :
> 
> On 2019-10-17 10:50, Klaus major-k via use-livecode wrote:
>> save some lines by setting the numberformat first (lazy moi :-)
>> ...
> Save even more lines by using format, div and mod...
> 
> function formatRemainingTime pSeconds
>  return format("%02d:%02d:%02d", pSeconds div 3600, (pSeconds mod 3600) div 
> 60, pSeconds mod 60)
> end formatRemainingTime

Sheesh... :-D

> Warmest Regards,
> 
> Mark.

Best

Klaus

--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Mark Waddingham via use-livecode

On 2019-10-17 10:50, Klaus major-k via use-livecode wrote:

save some lines by setting the numberformat first (lazy moi :-)

...



Save even more lines by using format, div and mod...

function formatRemainingTime pSeconds
  return format("%02d:%02d:%02d", pSeconds div 3600, (pSeconds mod 3600) 
div 60, pSeconds mod 60)

end formatRemainingTime

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-17 Thread Klaus major-k via use-livecode
Hi all,

> Am 17.10.2019 um 02:41 schrieb Terry Judd via use-livecode 
> :
> 
> Not built-in but...
> 
> function formatRemainingTime pTime
>   put trunc(pTime/3600) into tHours
>   put pTime mod 3600 into tTimeX
>   put trunc(tTimeX/60) into tMins
>   put tTimeX mod 60 into tSecs
>   if tHours < 10 then put "0" before tHours
>   if tMins < 10 then put "0" before tMins
>   if tSecs < 10 then put "0" before tSecs
>   return tHours&":"&":"
> end formatRemainingTime

save some lines by setting the numberformat first (lazy moi :-)

function formatRemainingTime pTime
   set the numberformat to "xx"
   put trunc(pTime/3600) into tHours
   put pTime mod 3600 into tTimeX
   put trunc(tTimeX/60) into tMins
   put tTimeX mod 60 into tSecs
   return tHours&":"&":"
end formatRemainingTime


Best

Klaus

--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-16 Thread hh via use-livecode
> Bill V. wrote:
> I know how to do the math to figure it out but I’m wondering if there
> is a built in function to do this. Convert wants to deal with actual time
> so I would get something like “0:1:15 PM”. 

That needs the same energy as the simple math method but as you ask:

1. set the twelvehourtime to false
2. compute what you get when converting t=0 to long time (=diff)
3. subtract diff from your start time
4. repeat converting your seconds value to long time


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-16 Thread Dar Scott Consulting via use-livecode
Perhaps the dateItems format would get you part of the way there. 

It seems like I have reinvented this in the past several times.

> On Oct 16, 2019, at 6:41 PM, Terry Judd via use-livecode 
>  wrote:
> 
> Not built-in but...
> 
> function formatRemainingTime pTime
>   put trunc(pTime/3600) into tHours
>   put pTime mod 3600 into tTimeX
>   put trunc(tTimeX/60) into tMins
>   put tTimeX mod 60 into tSecs
>   if tHours < 10 then put "0" before tHours
>   if tMins < 10 then put "0" before tMins
>   if tSecs < 10 then put "0" before tSecs
>   return tHours&":"&":"
> end formatRemainingTime
> 
> On 17/10/19, 11:24 am, "use-livecode on behalf of Bill Vlahos via 
> use-livecode"  use-livecode@lists.runrev.com> wrote:
> 
>I’m writing a countdown timer application and want to display the 
> remaining time not as the number of seconds but in the format of HR:MIN:SEC 
> left.
> 
>For example 75 seconds would display as “0:1:15”.
>130 seconds would display as “0:2:10”.
> 
>I know how to do the math to figure it out but I’m wondering if there is a 
> built in function to do this.
> 
>Convert wants to deal with actual time so I would get something like 
> “0:1:15 PM”.
> 
>Thanks,
>Bill Vlahos
>___
>use-livecode mailing list
>use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

2019-10-16 Thread Terry Judd via use-livecode
Not built-in but...

function formatRemainingTime pTime
   put trunc(pTime/3600) into tHours
   put pTime mod 3600 into tTimeX
   put trunc(tTimeX/60) into tMins
   put tTimeX mod 60 into tSecs
   if tHours < 10 then put "0" before tHours
   if tMins < 10 then put "0" before tMins
   if tSecs < 10 then put "0" before tSecs
   return tHours&":"&":"
end formatRemainingTime

On 17/10/19, 11:24 am, "use-livecode on behalf of Bill Vlahos via 
use-livecode"  wrote:

I’m writing a countdown timer application and want to display the remaining 
time not as the number of seconds but in the format of HR:MIN:SEC left.

For example 75 seconds would display as “0:1:15”.
130 seconds would display as “0:2:10”.

I know how to do the math to figure it out but I’m wondering if there is a 
built in function to do this.

Convert wants to deal with actual time so I would get something like 
“0:1:15 PM”.

Thanks,
Bill Vlahos
___
use-livecode mailing list
use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode