Hi,
I have an excel there is date column 30/11/2022. I want to take that date as dd/MM/yyyy format and write the full month name as NOVEMBER.
When I assign date like this it gives me 11/30/2022.
How can I do that?
Thanks.
Hi,
I have an excel there is date column 30/11/2022. I want to take that date as dd/MM/yyyy format and write the full month name as NOVEMBER.
When I assign date like this it gives me 11/30/2022.
How can I do that?
Thanks.
hi @makboga
If MyDate is a Datetime type, then MyDate.ToString("MMMM")
will return the result you want.
If MyDate is a string type formatted as you show above, then Datetime.ParseExact(MyDate, "M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MMMM")
will return the result you want.
regards
Mohini
Mark as solution if it helps you
Happy Automation …
If you will be having multiple date formats you can use this @makboga
DateTime.ParseExact(YourDateString,{"dd.MM.yyyy","MM/dd/yyyy","dd/MM/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM")
If you have any other formats just add them in the array of string in the expression {}
Regards
Sudharsan
Hi @makboga
You can try the below expression-
Month_Str = DateTime.ParseExact("30/11/2022","dd/MM/yyyy",system.Globalization.CultureInfo.InvariantCulture).ToString("MMMM")
Regards
Ashvani Kumar
HI @makboga
Try with this expression
Use ToUpper
in the last of the expression to get the Month in the Upper Case
DateTime.ParseExact("11/30/2022",{"MM/dd/yyyy","dd/MM/yyyy"}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM").ToUpper
Regards
Gokul
To Get the Values in Upper case just add .ToUpper in the end of the expression @makboga
DateTime.ParseExact(YourDateString,{"dd.MM.yyyy","MM/dd/yyyy","dd/MM/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM").ToUpper
Regards
Sudharsan
It is working thank you. I have one more question how can I write the month name in Turkish?
Checkout this
DateTime.ParseExact("30/11/2022",{"dd.MM.yyyy","MM/dd/yyyy","dd/MM/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MMMM",System.Globalization.CultureInfo.GetCultureInfo("TR-tr")).ToUpper
Regards
Sudharsan
Thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.