How to get todays date in format of dd/MM/yyyy and store in datetime variable

Hi,

Can anyone let me know how can I get todays date in format of dd/MM/yyyy and store in datetime variable for future use.

So far, I have tried to get date and store in string variable and convert using - Datetime.ParseExact(variable,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture). It is not working for me.

Thanks in Advance

@Hema1 Welcome to UiPath community you can assign str_Date in one variable and you can use this in future

                           Assign str_Date = Now.ToString("dd/MM/yyyy").ToString

@Hema1,

From where you are getting this date?
Also, is your date string in dd/MM/yyyy format. If yes, then only the below code will work

DateTime.ParseExact(dateStringVariable, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture)

If this doesn’t work, share your string date and if any error you are getting.