How to get only date

I am using datetime function to get the date but i dont want time. How to get only date?

Date.Now.toString("dd")

dd - date
MM - Month (01, 02 )
MMM - Month (JAN,FEB)
yy - year( 17,18)
yyyy - year (2017.2018)

6 Likes

If today’s date is 18/1/2018 but i have to work on yesterday’s date, how to write complete expression.I want to know the dynamic expression as my process demands to work on previous date. Please help.

Date.Now.addDays(-1).toString("dd")

3 Likes

thanks buddy

hi guys how can you get the name of the day

Hi @Jonga2018,

System.DateTime.Now.DayOfWeek.ToString()
Or
System.DateTime.Now.ToString("dddd")
Or
System.DateTime.Now.ToString("ddd")

Regards,
Arivu

2 Likes

Here is the full list of the VB.NET datetime formats you can get when you use datetime.tostring(“xxxx”)

3 Likes

You can use,

DateTime.Now.ToShortDateString
(or)
Date.Now.ToShortDateString

If u give variable type as Generic.

1 Like

Hi
Please follow below tutorial

1 Like