Write Cell for First of Current Month and first of current year

Have reporting I want to just have UiPath copy into an Excel file
1/1/2024 - Current Date, which I have as DateTime.Now.ToString(“MM/dd/yyyy”)
10/1/2024- Current Date

So the “time now” is really easy. How can I alter
DateTime.Now.ToString(“MM/dd/yyyy”)

to pick up the first day of the year (current year, so it will flip to 2025 eventually) and month?

I’ve noticed some ideas floating around where various dates are assigned then enumerated in another assigned activity. Thinking it could be easier than that?

Thanks

Hi @jwetherin

For first day of current year

New DateTime(DateTime.Now.Year, 1, 1).ToString("MM/dd/yyyy")

For first day of current month

New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString("MM/dd/yyyy")

You can assign these values to datetime variables

Hope this helps:)

That’s it. Thanks much.

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