how to set present date in “DD.mm.yyyy” format and
how to send date one year ago date in same format ?
Hi,
Today.ToString("dd.MM.yyyy")
and
Today.AddYears(-1).ToString("dd.MM.yyyy")
What do you mean by “set?”
Anyway, to output a datetime as a string, you use .ToString(format)
So today’s date in DD.mm.yyyy 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…
DateAdd(“yyyy”,-1,Now).ToString(“dd.MM.yyyy”)
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.
thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.