How to get the 1st day of the month

If I have date 26-07-2019 How can I get 01-07-2019 as an output

1 Like

@saandra

Hi, see below post

Rgds,

1 Like

Maybe not the best looking solution but I’ll work.

Assign to your variable this: Convert.ToDateTime(dateVariable.Month.ToString + "/01/" + dateVariable.Year.ToString)

I’m writing from my phone so I’ll double check the syntax if I were you, just in case! :sweat_smile:

EDIT: syntax updated

1 Like

Hi @saandra
Scenario 1: First convert the given string date into DateTime Variable
2: Assign the new date to the variable of datetime
3. Return the Formated output string.

See image below for your reference :smiley:

image

cheers :smiley:

Happy learning :smiley:

1 Like