Hi everyone,
I have a date stored in a variable at this format dd/MM/yyyy andI want to change at this one “MMMM” the problem is I need in Spanish, I’m using the next expression:
DateTime.ParseExact(variable ,“dd/MM/yyyy”, CultureInfo.CreateSpecificCulture(“es-ES”)).ToString(“MMMM”)
But it does not work, it converts in English.
Any idea??
mkankatala
(Mahesh Kankatala)
March 22, 2024, 5:44am
2
Hi @Diego_Marquez
Check the below expression,
DateTime.ParseExact(variable, "dd/MM/yyyy", CultureInfo.CreateSpecificCulture("es-ES")).ToString("MMMM", CultureInfo.CreateSpecificCulture("es-ES"))
Check the below image for better understanding,
Hope it helps!!
Vikas_M
(Vikas M)
March 22, 2024, 5:47am
3
Hi @Diego_Marquez ,
Kindly try below Expression
DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("dd 'de' MMMM 'de' yyyy", New CultureInfo("es-ES"))
You can replace DateTime.Now.ToString(“dd/MM/yyyy”) with your variable|
Below is the output for your reference
Hope it helps you out!
Tnks a lot it works perfectly
1 Like
system
(system)
Closed
March 25, 2024, 5:55am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.