Created
September 10, 2013 21:23
-
-
Save Yushell/6515905 to your computer and use it in GitHub Desktop.
Get DateTime.Now Day, Month, Year in Spanish & different formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CultureInfo ci = new CultureInfo("es-ES"); | |
// 29 | |
string vDia = Convert.ToString(DateTime.Now.Day); | |
// AGO | |
string vMes = Convert.ToString(DateTime.Now.ToString("MMMM", ci).ToUpper().Substring(0, 3)); | |
// 2012 | |
string vAnio = Convert.ToString(DateTime.Now.Year); | |
// 08 | |
string vMesNumero = Convert.ToString(DateTime.Now.ToString("MM")); | |
System.DateTime today = System.DateTime.Now; | |
// Calcular fecha 35 dias atras | |
DateTime vMes1 = today.Add(new TimeSpan(-35, 0, 0, 0)); | |
// AGO 2012 | |
string vMes1MES = Convert.ToString(vMes1.ToString("MMMM yyyy", ci).ToUpper().Substring(0, 3) + " " + Convert.ToString(vMes1.ToString("yyyy", ci).ToUpper())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment