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

john_wujohn_wu Member Posts: 2 Contributor I
edited June 2019 in Help

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!

 

Tagged:

Best Answer

Answers

  • john_wujohn_wu Member Posts: 2 Contributor I

    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)?

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    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. 

  • mmichelmmichel Employee, Member Posts: 129 RM Engineering

    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

     

Sign In or Register to comment.