"GandK-Geoff" wrote:
Just a note that this of course doesn't handle daylight savings time changes and suchlike, which means you can only trust it to get the right date, not time -- and then only far enough away from midnight -- but correct time for the "date in the past" may not be an actual requirement.
Truly correct handling of time requires a LOT of code and data. Most likely more than we want to carry around in a channel package ....
The roDateTime object assumes GMT. I would expect the .ToLocalTime() (last line of my sample code) to take care of the DST calculation, so you'd want to make sure the initial date is GMT prior to the calculation, but my assumption was that he just needed to do date and not time, based on his "arbitrary today minus x days" question.