Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Posts
    32

    Unanswered: how to extract month from 2 value

    hi,

    i want to ask about this situation

    how can i extract month value from 2 value selected ? it look like this

    i have first combobox a (month) b(year) then i select JAN 2003 then
    second combox c(month) d(year) then i select DEC 2003 and then i can input one value example like totalAmount = 10.00. After that stat from JAN2003 until DEC2003 will store the same value of totalAmount = 10.00

    Jan 2003 | Feb 2003 | March 2003 | ...| Dec 2003
    10.00 10.00 10.00 10.00

    it's that possible asp code be done? can u tell me how

  2. #2
    Join Date
    Mar 2003
    Location
    Atlanta, GA
    Posts
    191

    confused....

    I cannot figure out what it is you want to know.

    It sounds like you are selecting a date from each of two combo boxes, and applying an entered value to all the months between the selected dates. Is that it?

    If cDate1=the date from combo box1, and cDate2=the date from combo box2, then

    Then
    numMonths=DateDiff("m",cDate1,cDate2) returns the total number of months between cDate1 and cDate2.

    You could then use this in a For-Next loop

    For n=1 to numMonths
    newdate=DateAdd("m",n,cDate1)
    ... do other stuff based on newdate.
    Next 'n

    The DateDiff and DateAdd functions are both standard VBScript functions. The "m" parameter in each specifys that you want to work with months rather than days, years, seconds or whatever else.

    Hope this helps.

    Tim
    Tim

  3. #3
    Join Date
    Mar 2003
    Posts
    32

    Thumbs up

    yes it's exactly what i want to do.. ist that the value m can return month value between selected combo box

  4. #4
    Join Date
    Mar 2003
    Location
    Atlanta, GA
    Posts
    191

    so...

    So I don't know if you're asking another question.

    I showed you how to do it in my last post.

    Good Luck

    Tim
    Tim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •