Probably dumb question, but I haven't worked with Culture a whole bunch before. The assets for the date need to be:
MMMM dd "de" yyyy (w/o quotes on the "de").
junio 1 de 2015
What I have now:
CultureInfo ci = new CultureInfo("es-ES", false);
string date = DateTime.Now.ToString("MMMM dd REPLACE yyyy", ci).Replace("REPLACE", "de");
I want to know if there's a "more programatically correct" way of doing this that I do not know about rather than doing the string.Replace
Just quote the literal part with single quotes, double-quotes, or escape each character with a backslash:
string date = DateTime.Now.ToString("MMMM dd 'de' yyyy", ci);
string date = DateTime.Now.ToString("MMMM dd \"de\" yyyy", ci);
string date = DateTime.Now.ToString(@"MMMM dd \d\e yyyy", ci);
Note that in the second option we need to escape the "
within the string literal, and in the third option I'm using a verbatim string literal to avoid escaping the backslashes. Using single quotes is simplest :)
Read custom date and time format strings for more details in general about what you can do.
See more on this question at Stackoverflow