RapidMiner

Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

SOLVED
Contributor

Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

Hello dear support,

 

this function has a bug: date_get(date_now(),DATE_UNIT_MONTH) give "1" for February (actual month). Could you please fix this?

 

<?xml version="1.0" encoding="UTF-8"?><process version="7.2.002">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.2.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_macro" compatibility="7.2.002" expanded="true" height="68" name="Generate Macro (2)" width="90" x="380" y="493">
<list key="function_descriptions">
<parameter key="cur_date_month" value="date_get(date_now(),DATE_UNIT_MONTH)"/>
</list>
</operator>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
</process>
</operator>
</process>

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator
Solution
Accepted by topic author john_wu
‎02-13-2017 08:24 AM

Re: Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

4 REPLIES
Moderator
Solution
Accepted by topic author john_wu
‎02-13-2017 08:24 AM

Re: Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

Contributor

Re: Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

Thank you a lot!

 

Just to know: why is it so? And why take a year, day and hour "normal" values (if I am correct)?

Moderator

Re: Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

I don't have an answer as to why it's that way, I'm not a Java devleoper but I think it could be related to the Epoch calculations. 

Highlighted
RMStaff

Re: Bug: date_get(date_now(),DATE_UNIT_MONTH) gives "1" for February

Hi,

 

the Expression Parser in RapidMiner Studio is utilizing the Java Calendar and a long time ago SUN decided to to start with the index 0 (see the corresponding JavaDoc). This was probably done because months have names and are often mapped via monthNames[MONTH].

 

Cheers,

Marcel