Datetime.now issues

Hey,

I got this line of code ‘DateTime.Now.AddDays(1)’.
As expected it takes todays date and adds one.

When i run this in a process from a studio it works fine. If i publish the process it also runs fine until the next monday. Then it looks like DateTime.Now returns the date when the process was published to orchestrator.

Has anyone had this issue before?

Hi.

I have never seen Now return anything other than the current date time. I suspect either the computer clock was wrong on the machine when it ran on or there is a coding flaw with how you are using the date time value.

Other than that, I’m not sure.

Regards.

This is exactly how i use it currently:

System.DateTime.Now.AddDays(1).ToString(“MM.dd.yyyy”)

I also tried not including ‘System.DateTime’ to see if it made any difference.

I will check if there might be an issue with the system clock, thanks :slight_smile:

As I could see your requirement requires only date validation and not time, you can try using, System.DateTime.Today.AddDays(1).ToString(“MM.dd.yyyy”)

Hope this might help.

i will try to change it to this, thanks!

did it work?

1 Like

It worked 4 me