I would like to get the first day of the previous month.
I get the current execution time through the time generator node. And now i would like to get the first day of the previous month - so I can use these further down the workflow.
Eg.
I execute the workflow today, so the time generated is June 16, 2014
The date value I want to get back is the 1st of last month, so: May 1st, 2014
Is there a specific datetime calculator node somewhere or do I need to fall back to a Java snippet?
I'd say you can get this done by starting with a "date field extraction", followed by a "constant value" node for Day := 1 and a "math formula" node for Month := Month - 1, then recomposing the string with a column combiner (order doesn't matter) and parse results of this with "string to date". Slightly awkward, but it should work.
A DateTime calculator node would be a nice addition to the Time Series collection of nodes. Another useful addition would be a node that sets a field of a date to a specific value. Both of these nodes would be useful in gstoel's use case, and I suspect to others (including myself).
I've developed a couple of metanodes to perform these two tasks (attached). Simply configure each metanode in the usual way by right-clicking the metanode and selecting "Configure". As metanodes, they are easily reusable in other workflows.
Please note: although I performed some testing, these metanodes have not been exhaustively tested. Try them out and please check that they are calculating the expected values!