extract dates from string

madrav72

Registered User.
Local time
Today, 17:52
Joined
Dec 1, 2001
Messages
81
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
 
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.
 

Users who are viewing this thread

Back
Top Bottom