time2num
The time2num function returns a numeric time value in hours from a string like '04:35:14.45' or 04:35:14.45. Strings with enclosing ' ' are present in FITS image headers and are returned using CImage:KwdGetRaw.
NOTE: |
You may wish to test if the string is a time value before calling this function to avoid the ambiguous results for time2num("00:00:00") and time2num(0). |
nHours = time2num( sString ) |
sString is
the target string.
nHours is
the time in units of hours.
On
failure, 0.0 is returned.
The scripts below return the time value for several strings:
|
-- time string with ' ' |
|
|
|
-- prints t = 4.58734722 |
|
|
|
|
|
-- time string without ' ' |
|
|
|
-- prints t = 4.58734722 |
|
|
|
|
|
-- not a time |
|
|
|
-- skipped because not a time |
|
|
|
|
|
-- prints t = 0 |
|
-- prints t = 0 |
Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.