Problem with date format in AdjustDay method

Hi,

I’m writting an scheduled agent that creates time sheets document.

According a date, I have to define week number and first day of this week.

I get the date in a Datetime object in format mm/dd/yyyy.

Then to define week number I have to add or remove a number of days to this date.

I use the method .AdjustDay.

When I run manualy the agent, there is no problem, result is ok.

When agent is scheduled on server, result is wrong.

My problem is that the method seems to interpret my date as if format is dd/mm/yyyy and then result is completly wrong.

Exemple: my reference date is 02/03/2010 (mm/dd/yyyy format). I need to remove 2 days and result should be 02/01/2010 (mm/dd/yyyy format) and result is 28/02/2010.

this means that method remove 2 days to 2nd of March instead of removing to 3rd of February.

Any suggestion or tips?

Thanks

Sophie

Subject: Issue fixed

Hi,

I solve my problem.

Windows regional settings of the server on which run my agent was not correctly setup. It was English (United State) instead as English (United Kingdom)