Search code examples
filemaker

Get UTC time in FileMaker 11 scripts


How can I write a native FileMaker 11 script that returns the UTC time and saves this in a field or a variable? I would like to avoid plugins and AppleScript. A negative answer would also be helpful.

I would like to have functionality similar to this AppleScript:

set UTCTime to do shell script "date -u"
display dialog UTCTime

Output:

Thu Jun 16 07:10:42 UTC 2016

The following script step would work but was first introduced in FileMaker 11. http://www.filemaker.com/help/13/fmp/en/html/func_ref2.32.27.html

Get ( CurrentTimeUTCMilliseconds )

Returns:

63568967107528

I've also researched methods for determining the local time zone, but these also depend on having the UTC time first.


Solution

  • It is not possible to get UTC time natively in FileMaker Pro 11. The only times it get can is the local client time or the host time. Both are "wall clock" times - with no indication of the offset from UTC.

    If you don't want to use a plugin or OS-level script, then I believe your only resource would be using a web-viewer - either by getting the UTC from an external service (provided your system is on-line), or by having it run JavaScript locally.

    Note, however, that getting the result of JavaScript run in a web viewer back into FileMaker is far from trivial (see, for example, http://fmforums.com/topic/58535-scraping-data-from-a-javascript-variable/?do=findComment&comment=277317) and, in my experience, rather flimsy. If you really need this, I would recommend you do use a plugin or an OS script.