Results 1 to 3 of 3

Thread: [RESOLVED] formula help!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Resolved [RESOLVED] formula help!

    Hi I need an urgent help for you…

    I need to change the display for a field returned from an old XML and put it on to a new .XML file.

    Currently I have the following to block the date to be displayed, “-“ is displayed for each field as a result.

    Set oDoc = New DOMDocument
    oDoc.loadXML xmlstring
    Set nodList = oDoc.selectNodes("//date")
    For Each nod In nodList
    nod.Text = "-"
    Next

    How I need to work out now is instead of displaying “-“, I need them to be more details, compared to the current date. For example, if the date is “01/01/08”(this is the format in the old .xml), it will show “6 months ago”, and if the date is “20/01/07” it will show “18 months ago”. I can’t figure out a formula to compare months… and how can I get the value of <date> from the old .XML?? can someone please help.!! Thanks!!!

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    104

    Re: formula help!

    problem solved!

    Code:
             b = nod.Text
             c = DateDiff("m", b, a)
             If c < 24 Then
             nod.Text = c & " months ago"
             Else
             c = c / 12
             d = c Mod 12
             nod.Text = c &"years and" & d & " months ago"
             End If
    Thanks for your help!

Posting Permissions

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



Click Here to Expand Forum to Full Width