The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

calculate number of days between two dates

jeganathanvelujeganathanvelu Member Posts: 17 Contributor II
edited November 2018 in Help
Hi,

Requesting for help in finding out the number of days between two dates. Is it possible to eliminate weekends during this calculation ?

Thanks.

Answers

  • corkiecorkie Member Posts: 10 Contributor II
    using the generate attribute operator you can use the Regular expressions, and build a query with the inbuilt date functions.
    this would work to work the date diff okay, but to leave out the weekends not to sure.

    this would be my pseudo code for the reg ex expression.

    if date,
        then
              days = today - pref date
              weekday_count = days / 7 * 5
              return weekday_count
        else
              return date
    to generate your new attribute "weekday_count"
    check the "transaction date" attribute for a value.
    count the difference, to get the total days then work out 5/7 to get the no of week days between the two.
    return this value
    otherwise return the date value for the example (i.e unknown)
  • awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello

    There's an R package called "bizdays" that seems to have a function to do this.

    So if you're prepared to install the R extension and learn how to integrate with R from RapidMiner that might be the easiest way to go.

    There are some examples here that might help you up the learning curve http://rapidminernotes.blogspot.co.uk/search/label/R

    Hope that helps...

    regards

    Andrew
Sign In or Register to comment.