Hey!
You work too hard. This simplistic approach works:
on exitFrame me
gTheYear_RPF = "2001"
gTheMonth_RPF = "05"
gTheDay_RPF = "26"
gTheYear_RPT = "2001"
gTheMonth_RPT = "08"
gTheDay_RPT = "15"
set theStartDate = date(gTheYear_RPF & gTheMonth_RPF & gTheDay_RPF)
set theEndDate = date(gTheYear_RPT & gTheMonth_RPT & gTheDay_RPT)
set theNrOfWeeks = (theEndDate - theStartDate) / 7
put theNrOfWeeks
end
-- 11
Please watch the construction of the date objects closely. They must
not contain any quotes. Only the _contents_ of the date objects
contain quotes.
Good luck,
-Andreas
>Hello,
>I'm having trouble with the code below. The user enters a start
>date and an end date into two editable fields. I'm concatenating
>the info into a format nedded for date objects so I can subtract the
>start date from the end date to determine the number of days, then
>divide that by 7 for the number of weeks. I've added another step
>(which is writing to a field member) in the hopes of being able to
>loose the quotation marks, which I assume or screwwing things up
>because when I test by using: put theStartDate, the message window
>displays "date(20010502)". How do I get rid of the quotation marks
>form my variable?
>
> set gReportPeriodStartDate = "("&gTheYear_RPF&gTheMonth_RPF&gTheDay_RPF&")"
> set gReportPeriodEndDate = "("&gTheYear_RPT&gTheMonth_RPT&gTheDay_RPT&")"
> if gTimeToCalculate then
> set theStartDate = "date"&gReportPeriodStartDate
> set theEndDate = "date"&gReportPeriodEndDate
> set gReportPeriodWeeks = theEndDate - theStartDate
> set gReportPeriodWeeks = gReportPeriodweeks / 7
> put theStartDate into field "startDateTEMP"
> put theEndDate into field "endDateTEMP"
>
> set theStartDate = the text of field "startDateTEMP"
> set theEndDate = the text of field "endDateTEMP"
>
> set gReportPeriodWeeks = theEndDate - theStartDate
>
> put gReportPeriodWeeks into field "RPnumberOfWeeks"
> put gReportPeriodWeeks into field "CPnumberOfWeeks"
> updatestage
>
> set gTimeToCalculate = FALSE
> end if
>
>Thanx in advance,
>g fritzinger
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]