SQLTime ( )

Function stats

Average user rating
375
346
9999
Support
FileMaker 7.0 +
Date posted
08 February 2013
Version
1
Recursive function
No

Author Info
 Daniel Smith

8 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

SQLTime  ( theTime )


Parameters

theTime  


Description

Tags:  Sql  

Convert a time for use in an SQL Query.

Examples

Sample input

Time ( 18 ; 23 ; 05 )


Sample output

TIME '18:23:05'

 

Function code

/**
* ============================================================================
* SQLTime ( theTime )
*
* PURPOSE:
*        Convert a time for use in an SQL Query.
*
* RETURNS:
*        (text) time as text
*
* PARAMETERS:
*        theTime (time)
*
* EXAMPLE:
*        SQLTime ( Time ( 18 ; 23 ; 05 ) ) = "TIME '18:23:05'"
*
* HISTORY:
*        2013-JAN-11 - Created by Daniel Smith dansmith65@gmail.com
* ============================================================================
*/

"TIME "
& "'"
& Right ( 0 & Hour ( theTime ) ; 2 )
& ":"
& Right ( 0 & Minute ( theTime ) ; 2 )
& ":"
& Right ( 0 & Seconds ( theTime ) ; 2 )
& "'"


/*
// Unit test
Let ( [
    // specify output format
    ~outputEvaluate =
        "$output & If ( $expected = $actual ; \"pass \" ; \"-FAIL- \" )"
        & " & $test & \" | \" & Quote ( $expected ) & \" | \" & Quote ( $actual ) & \¶" ;
    // declare values that are used by multiple tests
        // none to declare for these tests
    
    
    $test = "valid output format" ;
    $value = Time ( 18 ; 23 ; 05 ) ;
    $expected = "TIME '18:23:05'" ;
    $actual = SQLTime ( $value ) ;
    $output = Evaluate ( ~outputEvaluate ) ;
    
    
    // set output to local let variable
    ~output = $output ;
    // Clean up variables
    $test = "" ;
    $value = "" ;
    $expected = "" ;
    $actual = "" ;
    $output = ""
] ;
    ~output
)
*/

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

    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/346

    Prototype: SQLTime( theTime )
    Function Author: Daniel Smith (http://www.fmfunctions.com/mid/375)
    Last updated: 08 February 2013
    Version: 1

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

 

 

 

 

 

 

 

Top Tags

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