Options

date format and date_add

Samuel_SchwarzeSamuel_Schwarze Member Posts: 2 Contributor I
edited November 2018 in Help
Hello,

I have a problem with a macro with the name time_frame. Its value is set on 27/07/2015 1:00:00 AM

In a loop I want to increase this marco with each loop by 5 Minutes. I tried: date_add(%{time_frame},5,DATE_UNIT_DAY), but that doesnt work.

The failure message is: Invalid argument type for 'date_add'. first argument must be Calendar

So the question is, where is the mistake?

Thank you in advance,

Samuel

Answers

  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,507 RM Data Scientist
    Hi,

    the first argument needs to be of type date. This means it needs to be in rapidminer date (milliseconds since 1970). You can use the parsing functions to convert your date into a RM date.

    Cheers,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Options
    Samuel_SchwarzeSamuel_Schwarze Member Posts: 2 Contributor I
    Thank you for your answer. Could you go a bit more in detail. I tried it with the Parse Numbers operator, but that doesnt work, because the input for the operator is missing.

    Sry, I am a bloody newcomer. Thank you
  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    you are looking for this:

    date_add(date_parse_custom(%{time_frame}, "dd/MM/yyyy hh:mm:ss a", "us"), 5, DATE_UNIT_DAY)
    Regards,
    Marco
Sign In or Register to comment.