Hi guys! I am trying to covert a current date to string.
However I encountered the following error:
This is weird because there is no 37th day in September.
How do I solve this error?
System.DateTime.Now.ToString(“mm/dd/yyyy”)
Hi guys! I am trying to covert a current date to string.
However I encountered the following error:
Try this:
System.DateTime.Now.ToString("MM/dd/yyyy")
mm - stands for minutes
MM - stands for month
Today’s Date
Now.ToString("dd/MM/yyyy")
Yesterday’s Date
Now.AddDays(-1).ToString("dd/MM/yyyy")
Try with this expression
yesterdaydate = DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy")
For more info about datetime manipulation check this:
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.