How to get date 1sy day of month

Hi all
how to get date 1st day of month?

Hey there, in order to help you can you provide an example?
Your question is vague

1 Like

Actually now.AddDays(-1).ToString(“dd.MM.yyyy”) this formula is get yesterday’s date
but I want 1st day of months date
what function should I use?
Thanks

hello @Abubakkar
please use “date.Now.AddDays(-(date.Now.Day-1)).DayOfWeek.ToString” to get the first day of the month.

Regards,
Ajay

3 Likes

@Abubakkar

Below one will give you first day of Month.

DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)

5 Likes

its working @Ajju but I want numeric date is it possible?
For ex: 01.05.2019

@Abubakkar use this
date.Now.AddDays(-(date.Now.Day-1)).Date.ToString(“dd.MM.yyyy”)

5 Likes

It’s working fine Thanks@buddy

How to get starting month of this year(2020)