Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
[SOLVED] Using date-values in context
Mario_Hofmann
Member Posts: 9 Contributor II
Hello,
I ve got a question regarding the usage of dates in the context. I set a macro startdate e.g. as "2012-12-01" in a macro.
When I want to calculate the difference to a date in an example set I m not able to convert the variable in a valid time string. Using date_parse_custom(%{startdate},"yyyy-MM-dd","de") does not work and gives me only errors.
I created a workaround by setting multiple macros for each year, month and day and reset the current date. There I encountered the problem that the month adds 1 month to the current date. E.g. date_set(date_now(),"12",DATE_UNIT_MONTH) returns 2013-01-014.
Thanks for any advice!
Regards,
Mario
I ve got a question regarding the usage of dates in the context. I set a macro startdate e.g. as "2012-12-01" in a macro.
When I want to calculate the difference to a date in an example set I m not able to convert the variable in a valid time string. Using date_parse_custom(%{startdate},"yyyy-MM-dd","de") does not work and gives me only errors.
I created a workaround by setting multiple macros for each year, month and day and reset the current date. There I encountered the problem that the month adds 1 month to the current date. E.g. date_set(date_now(),"12",DATE_UNIT_MONTH) returns 2013-01-014.
Thanks for any advice!
Regards,
Mario
0
Answers
nice to see that you are actually using RapidMiner!
Please remember that the macro is replaced *before* the actual evaluation of the expression. That means that you have to surround it with quotes in this case. Please have a look at the attached process for a working example.
Best!
Marius
perhaps you only missed to quote the macro in ?
I have attached an example process in which I used the date in the context to calculate the elapsed time between 2 dates.
Please keep in mind that the results represents the time in ms and you have to convert it afterwards (e.g. by dividing it by 86 400 000 to get the time in days ).
Hope that helps!
Best,
Edin
Thank you!