Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
Convert Time Format
Hi All,
I need some help with converting my time format. Within the dataset that I have, my time is in 24 hour format eg. 19:00 and 00:00. I am trying to convert these times into 12 hour format where 19:00 would turn into 7:00pm and 00:00 would turn into 12:00am.
I used Nominal to Date operator, and set the date type to time, date format to h:mm a, but it's giving me a cannot parse date error since 00:00 is an unparseable date. Any thoughts on solving this problem?
Thanks!
1
Answers
hello @jason_xie - I really should defer to @Marco_Boeck on this as I know how much he likes working with dates and times. But does this help?
Scott
Thanks so much, seems like it works the best if the variable has both date and time information. In my case, I have date and time as 2 different variables and the best way to approach it is to concac these two variables together and convert the time format then.
Would love to hear if @Marco_Boeck[community.rapidminer.com] has any other inputs on this issue.
Hi @jason_xie,
the format you were probably searching for was simply "hh:mm" and not "hh:mm a".
The date format parameter within the Operator Nominal to Date needs to know what the Attribute looks like.This means if your Attribute does not have AM or PM, the conversion cannot work.
If your string only has values like 00:00 then this setting will not work.
By the way:
Whereas the attribute types date / time / date_time are internally stored in milliseconds since 01/01/1970, the *visual* representation in RapidMiner is always of the format "MMM dd, yyyy hh:mm:ss a z" (e.g. Nov 20, 2017 1:16:53 PM CET).
If you want to have a different visualization you can only convert the attribute to nominal using the Operator Date to Nominal or a conversion function within Generate Attributes (e.g. date_str_custom()).
Best regards,
Edin
Dortmund, Germany