[SOLVED] date

katleensprietkatleenspriet Member Posts: 1 Contributor I
edited November 2018 in Help
Hey,

I have a date in my excel file as follows 20130510 as being May 10, 2013. I read it in as a numerical value and I want to convert it to a date. I used the generate attributes to first convert it to a text and then to a date as follows date_parse_custom(str(production_date),"yyyyMMdd","en"). The problem is that this gives me a datetime with the timestamp set at 12:00:00 AM CEST.

How do I get only a date ?

Answers

  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,965 RM Engineering
    Hi,

    have a look at the "Nominal to Date" operator.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.0.002">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="nominal_to_date" compatibility="6.0.002" expanded="true" height="76" name="Nominal to Date" width="90" x="246" y="30">
            <parameter key="attribute_name" value="Test"/>
            <parameter key="date_format" value="yyyyMMdd"/>
          </operator>
          <connect from_op="Nominal 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>
    Regards,
    Marco
Sign In or Register to comment.