wizardofogz / timespanextensions Goto Github PK
View Code? Open in Web Editor NEWThis library brings truly useful TimeSpan objects to .NET
This library brings truly useful TimeSpan objects to .NET
TimeSpanExt is a .NET library which makes timespans useful and easy. The functionality of TimeSpanExt greatly exceeds that of the TimeSpan class that ships with .NET. * Setup 1) Get the source: git clone git://github.com/WizardOfOgz/TimeSpanExtensions.git 2) Build the TimeSpanExtensions project 3) Include the library in your project. * Why use TimeSpanExt? - The code looks nice: DateTime searchStartDate = 1.Month().Ago; - Supports complex expressions: DateTime searchEndDate = searchStartDate + (1.Month() - 1.Day()); - Time spans can be stored and applied to more than one DateTime yielding the correct results: class ScheduleEvent { public string Name { get; set; } public DateTime StartAt { get; set; } public TimeSpanExt Duration { get; set; } public DateTime EndsAt { get{ return StartTime + Duration; } } } var vacationDuration = 1.Month(); var myVacation = new ScheduledEvent{ Name="One-month vacation", StartTime=DateTime.Parse("1/31/2011"), Duration=vacationDuration); DateTime backToWork = myVacation.EndsAt; // Feb 28, 2011 - Wait that's only 28 days from the start of my vacation! myVacation.StartTime = DateTime.Parse("3/30/2011"); // Change the start date. Duration is still one month. DateTime backToWork = myVacation.EndsAt; // Apr 30, 2011 - Much better, taking off 31 days. * Complex TimeSpanExts TimeSpanExt also supports addition and subtraction. The order of the operands is preserved as is shown in this example: var monthPlusDay = 1.Month() + 1.Day(); var dayPlusMonth = 1.Day() + 1.Month(); DateTime dt = DateTime.Parse("2/28/2010"); DateTime result; result = dt + monthPlusDay; // returns 3/29/2010 result = dt + dayPlusMonth; // returns 4/1/2010
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.