🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.

CLICK HERE TO DOWNLOAD

Read .Net system.datetime

oneponep Member Posts: 20  Maven
edited November 2018 in Help

Hello.

Is there any way that I can read a 18-digit .Net system.datetime in Rapidminer? I like to convert it to something readable for a human.

 

Here is an examble of a number; 634019213109374850

Which should be converted to 2010-02-16​T12:48:30.937Z

Answers

  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751  RM Founder

    Hi,

     

    That is actually pretty tough.  Originally I thought, that you can just convert the ticks into milliseconds and convert this into a date object (see process below).  But the problem is that this does not account for DST, leap seconds etc. which means that in aggregate you are roughly 4 weeks off :smileysad:

     

    I posted the process for educational reasons but this might not something you can easily solve without calling an external .Net routine (which is possible, e.g. with a command line call done by the operator "Execute Program").

     

    Cheers,

    Ingo

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.3.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.3.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="generate_data_user_specification" compatibility="7.3.000" expanded="true" height="68" name="Generate Data by User Specification" width="90" x="112" y="34">
    <list key="attribute_values">
    <parameter key="dot_net_date" value="634019213109374850"/>
    </list>
    <list key="set_additional_roles"/>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="7.3.000" expanded="true" height="82" name="Generate Attributes" width="90" x="246" y="34">
    <list key="function_descriptions">
    <parameter key="dot_net_date" value="(dot_net_date/10000)-(1970*365*24*60*60*1000)"/>
    </list>
    </operator>
    <operator activated="true" class="numerical_to_date" compatibility="7.3.000" expanded="true" height="82" name="Numerical to Date" width="90" x="380" y="34">
    <parameter key="attribute_name" value="dot_net_date"/>
    </operator>
    <connect from_op="Generate Data by User Specification" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" from_port="example set output" to_op="Numerical to Date" to_port="example set input"/>
    <connect from_op="Numerical to Date" from_port="example set output" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    </process>
Sign In or Register to comment.