Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Single Line Date in Months
//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; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here DateTime date = new DateTime(2003, 11, 25); DateTime today = new DateTime(2004, 12, 25); var time = (today.Year - date.Year > 1 ? (today.Year - date.Year - 1) * 12 : 0) + (today.Year > date.Year ? (today.Day >= date.Day ? today.Month + 12 - date.Month : today.Month + 12 - (date.Month + 1)) : (today.Day >= date.Day ? today.Month - date.Month : today.Month - (date.Month + 1))); Console.WriteLine(time); } } }
run
|
edit
|
history
|
help
0
ExtensionDateTime
QuickSort
Reverse linked list iterative method
With Arguments
3
sdefuy6j87uytgraxsd
lala
D110
IEquatable_Object compare
Program A