First day of the month

Hello,
i want to get the first date of the current month
i found few topics and agian all in Vb im trying in c#
For example for this month "march "
i want to get

01-MAR-2023
DD-MMM-YYYY
I have to use assign then ```
DateTime(date.Year, date.Month, 1)

but i have this issue the method is not invocable member datetime! 

Can i get some tips thanks.

try with new keyword:

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

Hi @Hazem_Saleh

Try with this expression

New DateTime(Now.Year,Now.Month,1).ToString(“dd-MM-yyyy”)

Regards
Gokul

Thanks for answering

Is iam using assign wrong way !

Hi @Hazem_Saleh

Try to reenter the Date Format

Regards
Gokul

Hi @Hazem_Saleh

There’s a relatively new activity that helps tremendously in this domain - the activity should be available both in StudioX and Studio. Try and see if you can find the “Modify Date” activity.

Input a date and set choose “Add modification” → “Find Start/End of Week/Month/Year”. Then, fine-tune the settings to get the first day of the month.

You can select the “Test” button in the activity to see what the result is for various inputs.

Moreover, you could add additional modifications (simply click “Add modification” again) - this way, you could get i.e. the first day of last month as well, depending on when your process is executed/triggered.

Best regards
Roman

Thanks this saved the day

1 Like

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