Brian Dunning's FileMaker Custom Functions

FMtoISO8601 ( FMTimestamp )

Converts a FileMaker timestamp to ISO 8601 YYYY-MM-DDTHH:MM:SS

  Be the first to rate this function Log in to vote

David A Sullivan   David A Sullivan - Show more from this author
Mandelbrot LLC
http://mandelbrotllc.com

Share on Facebook Share on Twitter

  Sample input:
FMtoISO8601 ( "3/8/2021 9:34:16 PM" )
  Sample output:
2021-03-08T21:34:16

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

A lot of javascript libraries need ISO 8601 formatted timestamps.

While it makes sense to a lot of JavaScript developers, formating your dates with the largest unit of time first (years), then descending down to the smallest unit (seconds), it sure does confuse users.

So, with this custom function, you can take a typical FileMaker timestamp like this:

3/11/2021 11:23:50 AM

And make it look like this:

2021-03-11T11:23:50

 

Comments

flusheDData   flusheDData, n/a
Apr 20, 2021
Hi,
To make sure the length of each element is two characters long you may use the Right function.

Year ( FMTimestamp ) &
"-" &
Right ( "00" & Month ( FMTimestamp ) ; 2 ) &
"-" &
Right ( "00" & Day ( FMTimestamp ) ; 2 ) &
"T" &
Right ( "00" & Hour ( FMTimestamp ) ; 2 ) &
":" &
Right ( "00" & Minute ( FMTimestamp ) ; 2 ) &
":" &
Right ( "00" & Seconds ( FMTImestamp ) ; 2 )

Best regards,
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: