madrav72
01-11-2006, 11:51 AM
how can i extract the two times from the following string ??
Free slot start: 13:30:00 End of Free slot: 15:00:00
i need to be able to store both times as in date type form
SammyJ
01-11-2006, 01:44 PM
str="Free slot start: 13:30:00 End of Free slot: 15:00:00"
intPos = instr(str, ":")
dtm1 = cdate(mid(str,intPos+1, 9))
intPos = instr(intPos+9, str, ":")
dtm2 = cdate(mid(str,intPos+1))
Assumes you'll always have the hh:nn:ss format with 8 characters. Could make it more robust by looking for the first space after the second character after intPos the first time, if you need to. Probably don't.
Obviously dimension your variables and all that.