Date Now showing more than 30 days a month

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 @Hou_Paang_Soul

Try this:
System.DateTime.Now.ToString("MM/dd/yyyy")

mm - stands for minutes
MM - stands for month

try this

System.DateTime.Now.ToString("MM/dd/yyyy")

@Hou_Paang_Soul

1 Like

Hi @Hou_Paang_Soul

Today’s Date

Now.ToString("dd/MM/yyyy")

Yesterday’s Date

Now.AddDays(-1).ToString("dd/MM/yyyy")

1 Like

Hi @Hou_Paang_Soul

Try with this expression

yesterdaydate = DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy")

@Hou_Paang_Soul

For more info about datetime manipulation check this:

1 Like

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