Set present date and one year ago date

how to set present date in “” format and
how to send date one year ago date in same format ?

1 Like





1 Like

What do you mean by “set?”

Anyway, to output a datetime as a string, you use .ToString(format)

So today’s date in would be Now.ToString(“dd.MM.yyyy”)

Make sure you get the format identifiers correct. Month number is MM not mm. Day number is dd not DD. This matters, they have to be exact.

To get one year ago today you subtract one year from now, then use .ToString with the same format…


1 Like

Thank you so much.

FYI there is a difference between Today and Now.

Today only gives you the month, day, year. Now gives you the time along with month, day year.



In the context of trying to get dd.MM.yyyy it doesn’t matter which you use, because both contain the date. But if you wanted to get, say, the current date AND time but a year ago, you’d have to use Now instead of Today.

yes, understand the difference between today and now.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.