Search this blog

Showing posts with label Date. Show all posts
Showing posts with label Date. Show all posts

Thursday, 23 May 2013

Finding the next Sunday

I was asked to create a process to find the next Sunday from a given date.

It's a bit clunky but here is a screenshot of the Generate Attributes operator with the various calculations. It shows how much flexibility there is hidden within this operator.



I'm not sure what would happen over a year boundary so it might be worth doing some more checks in this case.

I can think of a couple of other ways this could be done but I might ask for beer or money to work out the details.

Wednesday, 11 January 2012

Convert date to unix timestamp

Use the "Generate Attributes" operator and create an attribute with the following expression.

round (date_diff (date_parse (0), dateToConvert,"en","GMT")/1000)

Thursday, 17 February 2011

Converting unix timestamps in RapidMiner

If you have an attribute (called DateSecondsSince1970 say) containing the number of seconds since 1 Jan 1970 and you want to convert to a date_time attribute, use the "generate attributes" operator as follows.

Create an attribute called DateSince1970 and set it to date_parse(DateSecondsSince1970*1000)