Zum Hauptinhalt gehen

Suche

Suche

Date To Julian Date Trouble

Kommentare

1 Kommentar

  • Avatar
    Legacy Poster

    I figured out the problem.

     

    I had used the script function "Format: many times, but it is unsupported by the Bartender script interpreter, and I was not familiar with "FormatNumber", so when I was getting an error from the function "CDate", I incorrectly thought that it was also unsupported . AS it turns out the FormatNumber function was adding a comma to the four digit year, and that was breaking the CDate function.

     

    Here is the code that works.

     

    dim stryear
    dim strMonth
    dim vDate
    dim strBatch
    strBatch = IOLOT2
    strBatch =  Mid(strBatch,4, LEN(strBatch) - 3)

     

        strYear  = Left(strBatch ,2)
        strMonth= Right(strBatch,2)
        vDate=strMonth & "/01/" & strYear

     

    Value = CLng(FormatNumber(Year(vDate), "0000") _
                      + FormatNumber(DateDiff("d", CDate("01/01/" _
                      + FormatNumber(Year(vDate), "0000",,,False)), vDate) _
                      + 1, "000"))

     


     

     

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.