Output Spanish day of week - CSharp Language Basics

CSharp examples for Language Basics:Date Time

Description

Output Spanish day of week

Demo Code

using System;//ww  w  . j a va2 s.  c  o  m
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      DateTime enteredDate = DateTime.Now;
      // Finding day of week (in enumeration)
      DayOfWeek dayOfWeek = enteredDate.DayOfWeek;
      // Spanish texts
      string spanish = "";
      if (dayOfWeek == DayOfWeek.Monday)
         spanish = "Lunes";
      if (dayOfWeek == DayOfWeek.Tuesday)
         spanish = "Martes";
      if (dayOfWeek == DayOfWeek.Wednesday)
         spanish = "Miercoles";
      if (dayOfWeek == DayOfWeek.Thursday)
         spanish = "Jueves";
      if (dayOfWeek == DayOfWeek.Friday)
         spanish = "Viernes";
      if (dayOfWeek == DayOfWeek.Saturday)
         spanish = "S?bado";
      if (dayOfWeek == DayOfWeek.Sunday)
         spanish = "Domingo";
   }
}

Related Tutorials