PDA

View Full Version : Help parsing workout days


douglasw32
01-15-2010, 11:12 PM
I have a question, using the bris drf file, how does one go about calculating the days since the last workout?

headhawg
01-15-2010, 11:52 PM
Do you work with VB.net? If so, you could use the tsTimeSpan object. (I don't think that's available in VB6, is it?). Or get the Julian date for the race date and the last workout date and then subtract. Of course you have to first parse out the year, day, month from the data field. If you don't feel like writing the code just Google "Julian date function in VB" and you'll have plenty to choose from.

Isn't there a DateDiff function? It's been a while since I tried to code in VB.

douglasw32
01-16-2010, 09:28 AM
Head- Thanks ! that is enough keywords for me to google my way to it.

I do use VB6 however I am a major roookie as to what its potentials are, (well .. were) I should really move on.

Java and jquery looks interesting?

douglasw32
01-16-2010, 10:45 AM
Do you work with VB.net? If so, you could use the tsTimeSpan object. (I don't think that's available in VB6, is it?). Or get the Julian date for the race date and the last workout date and then subtract. Of course you have to first parse out the year, day, month from the data field. If you don't feel like writing the code just Google "Julian date function in VB" and you'll have plenty to choose from.

Isn't there a DateDiff function? It's been a while since I tried to code in VB.

Bingo! this did it...

date11 = ""

date11 = date11 + Mid$(drf(2), 5, 2) + "/"
date11 = date11 + Right$(drf(2), 2) + "/"
date11 = date11 + Left$(drf(2), 4)

date12 = ""
date12 = date12 + Mid$(drf(102), 5, 2) + "/"
date12 = date12 + Right$(drf(102), 2) + "/"
date12 = date12 + Left$(drf(102), 4)


date111(countit) = DateDiff("d", date12, date11)

MiJan
01-16-2010, 02:38 PM
You might want to be cautious using the "+" operator in a date statement. VB6 can be cruel in that area if using dates and text (or variants).

Yr = Val(Mid$(drf(102), 3, 2))
Mh = Val(Mid$(drf(102), 5, 2))
Dy = Val(Mid$(drf(102), 7, 2))

Date12 = Mh & "/" & Dy & "/" & Yr

douglasw32
01-16-2010, 03:17 PM
Thank You !

Handiman
01-16-2010, 10:06 PM
If you need to know how to do it in Liberty basic let me know.

Handi :)