Just in Time: A technical look at quantifying time

By: Laura Betz

The one constant every day is time ticks by and never ends; in the world of instant information we now have to have a way to track and measure time to the smallest fraction of a second. We race against it and use it up, trying to find how to live with time constantly. Deadlines and appointments have then been created, and in many instances time is money. So we have developed different systems on how it works, and how to put it in units to control all this. Many calendars have been made for days that have different lengths of time. With the world connecting more, we have to synchronize it more precisely.

Some things are important to record down to the millisecond. [Note: Use the function “Get(CurrentTimeUTCMilliseconds)”. (It can help with sorting after importing many records at the same time.)]

Currently, FileMaker dates are stored from January 1, 0001 to December 31, 4000, and time (and timestamps) are stored as seconds. They can be formatted to look different by using the Inspector, but generally looks like this:

10/21/2015 3:14:15 AM

 

This varies from the international format that looks something like this:

2015-10-21 03:14:15

 

When you put this into a timestamp field it will not be accepted.

Therefore, you have to reformat the timestamp to stop the error.  The calculation used, is as follows:

Let ( [

tDateStamp = GetAsTime ( RightWords ( “2015-10-21 03:14:15”; 1 ) ) ;

caTime = GetAsTime ( RightWords ( tDateStamp ; 1 ) ) ;

colonPos = Position ( tDateStamp ; “:” ; 1 ; 2 ) – 1 ;

dateStampTest = GetAsDate( tDateStamp ) ;

dateStampYear = Left ( tDateStamp ; 4 ) ;

dateStampMonth = Middle ( tDateStamp ; 6 ; 2 ) ;

dateStampDay = Middle ( tDateStamp ; 9 ; 2 )

] ;

If (

dateStampTest = “?” ;

Date ( dateStampMonth ; dateStampDay ; dateStampYear ) ;

GetAsDate ( tDateStamp )

) & “ “ & Left ( caTime ; colonPos )

)

With consistency we can deal better with time in our solutions and effectively optimize how we use it. The final question is…is it 5:00 yet?