Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
Calcula semana del año
//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.Text.RegularExpressions; using System.Globalization; namespace Rextester { public class Program { public static void Main(string[] args) { // Fecha que usaremos para calcular string fecha = "30/05/2017"; // Como averiguar el año de esa fecha // Convierte el string en fecha DateTime inputDate = DateTime.Parse(fecha.Trim()); // formatea la fecha de acuerdo a la zona del computador var d = inputDate; CultureInfo cul = CultureInfo.CurrentCulture; // Usa la fecha formateada y calcula el número de la semana int NumeroSemana = cul.Calendar.GetWeekOfYear( d, CalendarWeekRule.FirstDay, DayOfWeek.Monday); Console.WriteLine("La semana del año es: {0}",NumeroSemana); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Finding occurances of a value in the elements of a list
Combining strings and distincting them
Full text search using Linqdb
123
Ashraf
gh
project euler 15, C#
newstring vs regex
Testing 006
Get Bytecent Price in $USD
Please log in to post a comment.