Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Combustible SetUp
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string Ministerio = "Semana del 03 de agosto al 02 de agosto 2019"; string[] diaCom = Ministerio.Split(null); //Your code goes here DateTime nextSaturday = DateTime.Now.AddDays(1); while (nextSaturday.DayOfWeek != DayOfWeek.Saturday) nextSaturday = nextSaturday.AddDays(1); DateTime lastSaturday = DateTime.Now.AddDays(-1); while (lastSaturday.DayOfWeek != DayOfWeek.Saturday) lastSaturday = lastSaturday.AddDays(-1); List<Mes> Meses = new List<Mes>(){ new Mes(){NumeroMes=1, MesEs="Enero", MesEn="January", MesMin = "enero"}, new Mes(){NumeroMes=2, MesEs="Febrero", MesEn="February", MesMin = "febrero"}, new Mes(){NumeroMes=3, MesEs="Marzo", MesEn="March", MesMin = "marzo"}, new Mes(){NumeroMes=4, MesEs="Abril", MesEn="April", MesMin = "abril"}, new Mes(){NumeroMes=5, MesEs="Mayo", MesEn="May", MesMin = "mayo"}, new Mes(){NumeroMes=6, MesEs="Junio", MesEn="June", MesMin = "junio"}, new Mes(){NumeroMes=7, MesEs="Julio", MesEn="July", MesMin = "julio"}, new Mes(){NumeroMes=8, MesEs="Agosto", MesEn="August", MesMin = "agosto"}, new Mes(){NumeroMes=9, MesEs="Septiembre", MesEn="September", MesMin = "septiembre"}, new Mes(){NumeroMes=10, MesEs="Octubre", MesEn="October", MesMin = "octubre"}, new Mes(){NumeroMes=11, MesEs="Noviembre", MesEn="November", MesMin = "noviembre"}, new Mes(){NumeroMes=12, MesEs="Diciembre", MesEn="December", MesMin = "diciembre"}, }; Console.WriteLine("Dia, Fecha Actual: " +DateTime.Now.Day); Console.WriteLine("ultimo sabado: "+ lastSaturday.ToString("yyyy-M-d")); Console.WriteLine("proximo sabado: "+ nextSaturday.Day); Console.WriteLine(Meses.Where(a => a.MesEs == "Febrero").Select(b => b.MesEn).SingleOrDefault().ToString()); Console.WriteLine(diaCom[2]); string sab1 = nextSaturday.Day + " "+ nextSaturday.Month; string sab2 = diaCom[2] + " " + Meses.Where(a => a.MesEs == diaCom[4] || a.MesMin == diaCom[4]).Select(b => b.NumeroMes).SingleOrDefault().ToString(); Console.WriteLine(sab1+" separator "+sab2); /* for(int i=1;i <= Meses.Count();i++){ Console.WriteLine(Meses.Where(a => a.NumeroMes == i).Select(b => b.MesEn + " - " + b.MesEs).SingleOrDefault().ToString()); }*/ /* if(sab1 == sab2){ Console.WriteLine("Fecha Last Saturday"); }else if(sab1 <> sab1){ Console.WriteLine(""); }*/ int diff = DateTime.Compare(nextSaturday, lastSaturday); Console.WriteLine(nextSaturday.Date); Console.WriteLine(lastSaturday.Date); Console.WriteLine((nextSaturday.Date - lastSaturday.Date).TotalDays); if(diff==0){ Console.WriteLine("The Same"); }else if(diff < 0){ Console.WriteLine("Early"); }else{ Console.WriteLine("Late"); } List<Datos> datos = new List<Datos>(); datos.Add(new Datos(){ID = 1, Nombre = "Steven"}); datos.Add(new Datos(){ID = 2, Nombre = "Alexander"}); Console.WriteLine(datos.Where(b => b.ID == 1).Select(a => a.Nombre).SingleOrDefault().ToString()); for(int i = 0;i<=datos.Count();i++){ Console.WriteLine(datos[i].Nombre); } } public class Mes{ public int NumeroMes{get;set;} public string MesEs{get;set;} public string MesEn{get;set;} public string MesMin{get;set;} } public class Datos{ public int ID {get;set;} public string Nombre {get;set;} } } } //https://rextester.com/MFEVL59444
Show compiler warnings
[
+
]
Show input
edit mode
|
history
|
discussion