Rapidminer Date Time formatting with the Nominal to Date Operator

JessForbesRMJessForbesRM RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 38 RM Data Scientist
edited November 2018 in Knowledge Base

What on earth is “MM dd, yyyy”?

 

Parsing your date and/or times from the default nominal text string can be a daunting task.  It doesn’t have to be.

 

Using our Nominal to Date operator can be very simple if you know where to start.

The Nominal to Date operator converts the selected nominal attribute of the input ExampleSet into the selected date and/or time type. The attribute is selected by the attribute name parameter. The type of the resultant date and/or time attribute is specified by the date type parameter. The nominal values are transformed into date and/or time values. This conversion is done with respect to the specified date format string that is specified by the date format parameter.

It is important to note that the old nominal attribute will be removed and replaced by a new date and/or time attribute if the keep old attribute parameter is not set to true.

 

The given date and time are 2001-07-04 12:08:56 local time in the U.S. Pacific Time time zone, here are some examples for parsing the ways that date can be formatted in your data set  

  • 'yyyy.MM.dd G 'at' HH:mm:ss z': 2001.07.04 AD at 12:08:56 PDT
  • 'EEE, MMM d, yy': Wed, Jul 4, '01
  • 'h:mm a': 12:08 PM
  • 'hh 'oclock' a, zzzz': 12 oclock PM, Pacific Daylight Time
  • 'K:mm a, z': 0:08 PM, PDT
  • 'yyyy.MMMMM.dd GGG hh:mm aaa': 2001.July.04 AD 12:08 PM
  • 'EEE, d MMM yyyy HH:mm:ss Z': Wed, 4 Jul 2001 12:08:56 -0700

 

To learn more about the Nominal to Date Operator check out our documentation site - Nominal To Date Operator Documentation

stevefarrLeslie_Miller

Comments

  • rexksviirexksvii Member Posts: 4 Contributor I

    Hi, i got a question would like to ask you. 

     

    I have a column of data with date format like this "8/22/16 10:40"(in polynominal type) and I wanted to convert it to date format like "Aug 22,16 10:40:00PM" in Date_time type.

     

    I tried to use Nominal to Date operator but I got an error message said "Cannot parse date".

     

    Can you help me solve this issue? thanks

  • JessForbesRMJessForbesRM RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 38 RM Data Scientist

    @rexksvii I am so sorry for the delay in this, I somehow missed this comment.

     

    It sounds like the parameters on your operator are slightly off, this error occurs if you are trying to parse a date but the format is not correct.

     

    You can find the documentation on this operator here Nominal to Date Operator

     

    The critical part is here : 

     

    date format
    This is the most important parameter of this operator. It specifies the date time format of the selected nominal attribute. Date format strings are discussed in detail in the description of this operator.

    Type: selection
    Range: , yyyy.MM.dd G 'at' HH:mm:ss z, EEE, MMM d, ''yy, h:mm a, hh 'o''clock' a, zzzz, K:mm a, z, yyyy.MMMMM.dd GGG hh:mm aaa, EEE, d MMM yyyy HH:mm:ss Z, yyMMddHHmmssZ, yyyy-MM-dd'T'HH:mm:ss.SSSZ, ...

     

     

     

     

    For your example of "8/22/16 10:40" you would need MM/dd/yy h:mm

Sign In or Register to comment.