🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Date values conversion

RyanRezelUser: "RyanRezel"
New Altair Community Member
Updated by Jocelyn
Hi,
I am fairly new to RM and my first task has a column with inconsistent date values, it is entered as for example 0055 for the year whereas it should be 1955, I have tried a few options but have failed can anyone provide me with some assistance, please.

Thanks 
Ryan

Find more posts tagged with

Sort by:
1 - 4 of 41
    Hi,
    that's nasty, who came up with this notation?  What would be 0019? 1919 or 2019?
    In any case, i suspect you need to read it in as a Polynominal value and then parse the string. For example with Generate attributes.
    Best,
    Martin
    Hi mschmitz 
    I assumed it was 1919 for example since in the statistics tab it shows that the latest date is May 7, 1992.
    Is hope such an assumption alright.
    Can you elaborate on how I can parse it, please?
    thank you 
    Ryan
    attached is an easy way how to do it. I am not 100% sure about your date format, so you may adapt this a bit more.
    Best,
    Martin

    <?xml version="1.0" encoding="UTF-8"?><process version="9.7.002">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.7.002" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="utility:create_exampleset" compatibility="9.7.002" expanded="true" height="68" name="Create ExampleSet" width="90" x="112" y="34">
            <parameter key="generator_type" value="comma separated text"/>
            <parameter key="number_of_examples" value="100"/>
            <parameter key="use_stepsize" value="false"/>
            <list key="function_descriptions"/>
            <parameter key="add_id_attribute" value="false"/>
            <list key="numeric_series_configuration"/>
            <list key="date_series_configuration"/>
            <list key="date_series_configuration (interval)"/>
            <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="input_csv_text" value="date&#10;0019&#10;0050&#10;1920&#10;1992"/>
            <parameter key="column_separator" value=","/>
            <parameter key="parse_all_as_nominal" value="true"/>
            <parameter key="decimal_point_character" value="."/>
            <parameter key="trim_attribute_names" value="true"/>
          </operator>
          <operator activated="true" class="replace" compatibility="9.7.002" expanded="true" height="82" name="Replace" width="90" x="246" y="34">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="date"/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="nominal"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="file_path"/>
            <parameter key="block_type" value="single_value"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="single_value"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="replace_what" value="00(\d\d)"/>
            <parameter key="replace_by" value="19$1"/>
          </operator>
          <operator activated="false" class="nominal_to_date" compatibility="9.7.002" expanded="true" height="82" name="Nominal to Date" width="90" x="447" y="34">
            <parameter key="attribute_name" value="date"/>
            <parameter key="date_type" value="date"/>
            <parameter key="date_format" value="yyyy"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="keep_old_attribute" value="false"/>
            <description align="center" color="transparent" colored="false" width="126">if you want to you can convert this now</description>
          </operator>
          <connect from_op="Create ExampleSet" from_port="output" to_op="Replace" to_port="example set input"/>
          <connect from_op="Replace" 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>


    Thank you very much Martin.