Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3336 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hi,

Since I could not use 10ths of seconds in FMP I’ve been converting the time and presenting it this way [Time*24**60*60]. This is fine by me, but I suppose some users might not care for it. Is there a way to reverse this in FMP — to take, i.e., 73.3 and get back 1:13.3 or 1.13.3?

 

Thanks,

Paul

Edited by Poruchan
Posted

Experiment with this - define a script:

Set Variable["$t", "GetAsTimestamp ( ( Get ( CurrentTimeUTCMilliseconds ) + ( -7 * 3600000 ) ) / 1000 ) "]
Pause/Resume Script [ Duration (seconds): 5]
Set Variable["$t", "GetAsTimestamp ( ( Get ( CurrentTimeUTCMilliseconds ) + ( -7 * 3600000 ) ) / 1000 ) - $t "]
Show Custom Dialog ["Result", $t ]

calculalation is from FMP14's online help:

http://www.filemaker.com/help/13/fmp/en/html/func_ref2.32.27.html

Hope this helps!

Posted

I could not use 10ths of seconds in FMP

Why not?

 

I’ve been converting the time and presenting it this way [Time*24**60*60].

Huh?

 

Is there a way to reverse this in FMP — to take, i.e., 73.3 and get back 1:13.3 or 1.13.3?

Well,

GetAsTime ( 73.3 )

returns 0:01:13.3.

Note that this converts seconds to time, in hours, minutes and seconds - not just minutes as your title would suggest. And this does not reverse Time*24*60*60. If you did that, you would have received 6333120 as the result instead of the original 73.3. The reverse action is simply:

GetAsNumber ( Timefield )

 

Posted

"Why not?"

Really? Can I? I haven't been able to import race times such as 1:58.1 (min:sec.x) from Excel. (plus I've had a bunch of problems in Excel because of the colon)

"Huh?"

So in Excel I multiplied  the race time  such as 1:13.6 * 24 * 60 * 60 to get 73.6 -- and have been happily working in seconds.

I can stick with seconds, but presentation-wise, people want what they are used to -- I'll stick with the seconds unless I can get exactly 1:13.6 or 1.13.6 

Posted

 I haven't been able to import race times such as 1:58.1 (min:sec.x) from Excel.

Using fractional seconds in Filemaker is one thing. Importing from Excel is another. Filemaker and Excel have very different concepts of time* - and importing from Excel is always an adventure, especially when it comes to dates and times. 

Importing the time as decimal seconds (i.e. 73.6) into a Number field may well be the safe route to take here (I am not able to test the alternatives ATM).

 

presentation-wise, people want what they are used to -- I'll stick with the seconds unless I can get exactly 1:13.6 or 1.13.6 

As I said earlier, GetAsTime() will do the conversion for you. Note that if the result type is Time, and you format the field to display as anything other than "As entered", the fractions of second will not be displayed.

---
(*) For calculation purposes, Filemaker perceives time as the number of seconds elapsed since midnight, while Excel sees it as a fraction of the day. Thus the time of 6:00:00 AM is converted to 21600 in Filemaker, but Excel considers it the equivalent of 0.25.

  • Like 1
Posted

For some reason FM is recieving the time with some extras:

Excel: 1:55.8 > 115.8

Import

FM: Shows 115.8, but clicking in the field shows 115.79999999999998

and GetAsTime() returns 0:01:55.799999

Not all of them, but the lions share. No luck with formating

But this is low priority - I’ve grown accustomed to using seconds. Thanks ― I’ll play around with it.

Posted

FM: Shows 115.8, but clicking in the field shows 115.79999999999998

and GetAsTime() returns 0:01:55.799999

What you see when you click into the field is the actual value imported from Excel. Try rounding the Excel calculation to one decimal place. Or do it in Filemaker =

GetAsTime ( Round ( ImportedField ; 1 ) )

 

Posted (edited)

Did it in Filemaker -- works great, thanks ... so, about the first three characters in the time [0:0]1:55 -- is it possible to remove them?   I'm thinking it's not as it is from a calculation.

What a shame - if I just limit the size of the filed on the layout it reduces nicely, but from the right.

I shamelessly covered the first three characters with a little white box. Looks great. 

Edited by Poruchan
Posted

so, about the first three characters in the time [0:0]1:55 -- is it possible to remove them?   I'm thinking it's not as it is from a calculation.

Anything is possible. In this case, I would do a slightly different calculation =

Let ( 
t = Round ( ImportedField ; 1 ) 
;
Minute ( t ) & SerialIncrement ( ":00" ; Seconds ( t ) ) & SerialIncrement ( ".0" ; 10 * Mod ( t ; 1 ) )
)

The result type must be Text.  Note that this assumes that the time never exceeds 3599.9 seconds (otherwise it rolls back to 0).

Posted

Wow, that's nice. I'm just sitting here handing you the hammer. Thanks.

This topic is 3336 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.