Not that this solves your particular problem but some might be interested in
this function. I will see if I can include this scenario in my function at some
point.
Bob S
function formatTime theTime, theFormat
/*
accepts any valid time and returns the form of the time specified in the
second parameter.
The valid formats are:
sql time: hh:mm:ss (Note: combining sql date from the formatDate() function
with the
sql time will produce a valid SQL date time type).
short time: LC short time format
abbreviated time: LC abbr time format (same as short time)
long time: LC long time format
seconds: the number of seconds since the prior midnight
military: the military time 00:00 - 23:59
*/
set the numberFormat to "00"
switch theFormat
case "sql time"
convert theTime to dateitems
put (item 4 of theTime +0) & ":" & \
(item 5 of theTime +0) & ":" & \
(item 6 of theTime +0) into theTime
break
case "short time"
convert theTime to short time
break
case "abbreviated time"
convert theTime to abbreviated time
break
case "long time"
convert theTime to long time
break
case "seconds"
convert theTime to seconds
break
case "military"
set the itemDelimiter to ":"
if theTime contains "PM" then
add 12 to item 1 of theTime
end if
put word 1 of item 2 of theTime into item 2 of theTime
break
end switch
return theTime
end formatTime
On Jan 28, 2015, at 21:28 , Geoff Canyon
<[email protected]<mailto:[email protected]>> wrote:
On Wed, Jan 28, 2015 at 8:12 PM, Brahmanathaswami
<[email protected]<mailto:[email protected]>> wrote:
2000-02-17T22:13:21-05
As anyone written a script to convert this to seconds?
If the positioning is fixed (as is implied by the leading 0s) then I think
this will work:
function S D
put format("%s/%s/%s %s",char 6 to 7 of D,char 9 to 10 of D,char 1 to 4
of D,char 12 to 19 of D) into R
convert R to seconds
return R + 3600 * char -3 to -1 of D
end S
_______________________________________________
use-livecode mailing list
[email protected]<mailto:[email protected]>
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode