Deal with Extract Macro datetime issue

phivu
phivu New Altair Community Member
edited November 2024 in Community Q&A

Hi RapidMiner,

 

I got an issue when using Extract Macro with datetime values. The datetime value i want to extract is "Dec 03, 2016 9:04:51 AM", but after using Extract Macro, the value extracted is "03/12/2016 09:04:51 AM" (I used Log operator to see this value), which mean "Mar 12, 2016 9:04:51 AM" (day becomes month and month becomes day). And then when I used Filter Examples to keep only records after "Dec 03, 2016 9:04:51 AM", i got all records after "Mar 12, 2016 9:04:51 AM", which is not what i want. Do you have any idea to solve this? Thank you very much.

 

I attached my process here.

 

Best,

phivu

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answers

  • Edin_Klapic
    Edin_Klapic New Altair Community Member
    Answer ✓

    Hi phivu,

     

    I recommend using Generate Attributes to create a numerical Attribute representing the date value in milliseconds since Jan, 1st 1970 (see screenshot).

    You can then apply Extract Macro and Filter Examples on this attribute.

     

    Best,

    Edinimage.png

     

     

     

     

  • phivu
    phivu New Altair Community Member
    Answer ✓

    Thanks Edin, this should work.

     

    Best

    phivu

Answers

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    Thanks for the process but I can't see your data. Can you verify that the date-time you actually use in the process is set as date-time format by RapidMiner?

  • Telcontar120
    Telcontar120 New Altair Community Member

    I'm not saying this isn't a problem, but it sounds like a date format issue--the difference described is between the American vs the European way of writing dates (3/12/16 is March 12th to an American and Dec 3rd to a European).  The date format could be modified in RapidMiner using Date to Nominal and then Nominal to Date using a different format.  There may be a more efficient way of solving this though.

     

  • phivu
    phivu New Altair Community Member

    Hi Thomas,

     

    The datetime i used is under RapidMiner format. I attached the input data in this message.

    The problem here i think is the inconsistence between "Extract Macro" (EM) and "Filter Examples" (FE). FE uses the datetime value from EM but it reads the value in a different format (as what Brian explained above).

     

    Thanks.

     

    Best,

    phivu

    ACV1.csv 942.8K
  • Edin_Klapic
    Edin_Klapic New Altair Community Member
    Answer ✓

    Hi phivu,

     

    I recommend using Generate Attributes to create a numerical Attribute representing the date value in milliseconds since Jan, 1st 1970 (see screenshot).

    You can then apply Extract Macro and Filter Examples on this attribute.

     

    Best,

    Edinimage.png

     

     

     

     

  • phivu
    phivu New Altair Community Member
    Answer ✓

    Thanks Edin, this should work.

     

    Best

    phivu

  • Telcontar120
    Telcontar120 New Altair Community Member

    You can do a similar extraction directly with the "Date to Numeric" operator, and choose units other than milliseconds as well (if you'd rather think about this in a unit that is not as large in absolute terms or that is more meaningful to you like days or weeks).

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.