UUID.GetTimestamp ( )

Function stats

Average user rating
260
277
9999
Support
FileMaker 10.0 +
Date posted
04 October 2010
Last updated
13 May 2011
Version
Recursive function
No

Author Info
 Jeremy Bante

10 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

UUID.GetTimestamp  ( theID )


Parameters

theID  


Description

Tags:  Uuid   Timestamp   Time  

UUIDGetTimestamp( uuid ) extracts the creation timestamp from a numeric UUID, such as created by the UUIDTimeNIC function. Note that the sub-second portion of the result is not reliable as an actual time, and should only be interpreted as an ordinal value.

Examples

Sample input

1-2-063440624691-3530000-04098-000102857824654


Sample output

5/10/2011 11:44:51.353 AM

 

Function code

/**
* ======================================
* UUIDGetTimestamp ( theID )
*        https://github.com/jbante/FileMaker-Techniques/blob/master/CustomFunctions/UUID/UUIDGetTimestamp.fmfn
*
* PURPOSE:
*        Extracts the creation timestamp from a numeric UUID created by this
*        family of UUID functions. The returned value can be converted to a more
*        conventional format with the GetAsTimestamp function.
*
* RETURNS:
*        A number representing the number of seconds since 0001-01-01 00:00:00
*        when the UUID passed as a parameter to the function was created. Returns
*        Null ("") if the UUID is in a format that does not contain a retrievable
*        timestamp.
*
* PARAMETERS:
*        theID: The UUID to extract a timestamp from.
*
* DEPENDENCIES: none
*
* HISTORY:
*        MODIFIED on 2011-02-02 by Jeremy Bante to use a format with a bijective
*        relationship with the RFC 4122 format.
*        MODIFIED on 2010-11-22 by Jeremy Bante <http://scr.im/jbantetsg> to
*        extract timestamps from the updated output format for UUIDNew.
*        CREATED on 2010-09-12 by Jeremy Bante <jeremy@kyologic.com>.
*        INSPIRED by UUID functions created by Ray Cologon.
*
* REFERENCES:
*        Key values Best Practice: http://filemakerstandards.org/pages/viewpage.action?pageId=557138
*        Ray Cologon's uID functions: http://www.nightwing.com.au/FileMaker/demos9/demo910.html
*        UUID functions: https://github.com/jbante/FileMaker-Techniques/tree/master/CustomFunctions/UUID
* ======================================
*/
Let( [
    ~idAsNumber = GetAsNumber ( theID );
    ~length = Length ( ~idAsNumber );
    ~version = Left ( ~idAsNumber ; ~length - 40 )
];
    If ( ~version < 3;
        GetAsTimestamp ( GetAsNumber (
            Middle ( ~idAsNumber ; ~length - 38 ; 12 ) //seconds
            & "."
            & Middle ( ~idAsNumber ; ~length - 26 ; 7 ) //sub-seconds
        ) )

        /* Else, UUID does not have a timestamp; return Null */
    )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/277

    Prototype: UUID.GetTimestamp( theID )
    Function Author: Jeremy Bante (http://www.fmfunctions.com/mid/260)
    Last updated: 13 May 2011
    Version: 3.0

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (30)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (13)
Filter  (12)
Design  (11)
Layout Objects  (11)
Array  (8)