is_datetime


The is_datetime function determines if a string value is an ISO 8601 time value like '2005-09-28T04:35:14.45' or 2005-09-28T04:35:14.45. Strings with enclosing ' ' are present in FITS image headers and are returned using CImage:KwdGetRaw.

Syntax

bResult = is_datetime( sString )

bullet.gif    sString is the string to test.

bullet.gif    bResult = true if the string is an ISO 8601 time value.

bullet.gif    bResult = false if not.

Example

The script below evaluates a string to test whether is is in ISO 8601 format:

str1 = "'2005-09-28T04:35:14.45'"

-- ISO 8601 string with ' '

bTrue = is_datetime( str1 )

 

Printf("result = %s\n", booltostr(bTrue))

-- prints result = true

 

 

str2 = "2005-09-28T04:35:14.45"

-- ISO 8601 string without ' '

bTrue = is_datetime( str2 )

 

Printf("result = %s\n", booltostr(bTrue))

-- prints result = true

 

 

str3 = "Johhny"

-- string, but not time

bTrue = is_datetime( str3 )

 

Printf("result = %s\n", booltostr(bTrue))

-- prints result = false

 

 

str4 = 4.45

-- not a string

bTrue = is_datetime( str4 )

 

Printf("result = %s\n", booltostr(bTrue))

-- prints result = false

Related Topics

datetime2num

is_time

booltostr

String Type Functions


Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.