The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
How to get part of the date?
I have an attribute "time" in a data set, which format is also date, its value is like "Mar 9, 2010 3:51:34 AM CET".
- I want to generate two new attributes, one is "day": for example: Mar 9, 2010
- the other is "hour": for example: 3:51:34 AM
So, I use the "Generate Attributes", but I don't know, how to write the expressions. I tried for date_get(date_get(time, DATE_UNIT_DAY)) for the first case, but I get just exactly the number 9, nothing else.
How can I get the part of the day and the exact time in the day?
- I want to generate two new attributes, one is "day": for example: Mar 9, 2010
- the other is "hour": for example: 3:51:34 AM
So, I use the "Generate Attributes", but I don't know, how to write the expressions. I tried for date_get(date_get(time, DATE_UNIT_DAY)) for the first case, but I get just exactly the number 9, nothing else.
How can I get the part of the day and the exact time in the day?
0
Answers
you're looking for these functions: Regards,
Marco
thanks very much for the answer!
Are there a detailed discription with examples about how to use the time functions?
have a look here: http://docs.rapidminer.com/studio/operators/data_transformation/attribute_space_transformation/generation/generate_attributes.html
From inside Studio you can get help by activating the "Help" view and selecting the operator you want help for.
Regards,
Marco
Hi,
I was looking for the same solution, the only thing is I need to present the month as "Nov" and not "11".
when I write 'date_str_custom(date, "yyyy/MM")' in generate new attribute operator I recieve the result as : 2017/11 but I need: 2017/Nov.
Then How can we define the final presentation of month in this context?
Thanks and regards,
Helena
Hi @helena_ahmadi,
A list of the available patterns can e.g. be found in the Help of the Operator Date to Nominal which is also available online on https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/date_to_nominal.html.
In your case you just need to add a "M" to your expression leading to date_str_custom(date, "yyyy/MMM").
In Generate Attributes you can also define which localization you want to use e.g. date_str_custom(date, "yyyy/MMM","us").
Happy Mining,
Edin
Hi @Edin_Klapic,
Thanks, it worked now.
Because I found this usefull when needing to generate date info, I thought I would put it here.
Generating a date and inserting into a feed.